Can't pass proxy with python v4 client

Please tell me how to pass proxy with weaviate.connect_to_wcs() ?
Or can I disable GRPC?

Hi @syucchin!

Thats a great question!
And I believe it’s not yet documented. So thanks for that :slight_smile:

I am not sure if GRPC proxied connections is possible as couldn’t find evidence of that :frowning: I have asked our developers about this.

When you initiate the client, it will do some initial checks. To avoid that, you can pass skip_init_checks = True. This will prevent the client failing due to not being able to connect to GRPC.

Now, for the proxied REST connection, you can pass additional configuration for you client.

One option is to use trust_env, so it will take into consideration the HTTP_PROXY and HTTPS_PROXY of your environment variables:

import weaviate
client = weaviate.connect_to_wcs(
    skip_init_checks=True,
    cluster_url="YOUR_URL_HERE",
    auth_credentials=weaviate.auth.AuthApiKey("YOUR_API_KEY_HERE"),
    additional_config=weaviate.config.AdditionalConfig(
        trust_env=True
    )
)

The second option is to pass the proxy configuration whithin the client, using the proxies option:

import weaviate
proxies = {
   'http': 'http://proxy.example.com:8080',
   'https': 'http://secureproxy.example.com:8090',
}
import weaviate
client = weaviate.connect_to_wcs(
    skip_init_checks=True,
    cluster_url="YOUR_URL_HERE",
    auth_credentials=weaviate.auth.AuthApiKey("YOUR_API_KEY_HERE"),
    additional_config=weaviate.config.AdditionalConfig(
        proxies=proxies
    )
)

Let me know if this helps :slight_smile:

Thank you for your reply, but these didn’t work, both.