Hi, does anybody have an example how to configure ...
# gooddata-cloud
d
Hi, does anybody have an example how to configure proxy settings in gooddata python sdk? Using simple request.get statements I'm able to reach API, but it seems that due to proxy GoodDataAPIClient can't reach the host. Thank you.
j
Hi Dmytro, Is there any reason why you do not use GoodDataSdk? GoodDataApiClient is a generated client from open api specification where we can not ensure that everything will work. If there is a missing feature in GoodDataSdk, please tell us, and we can implement it, or if you want, you can add it yourself. Our Python SDK is open source. https://github.com/gooddata/gooddata-python-sdk
d
Yes, I've started from SDK , in documentation it accept host and token to initialize SDK, but I don't see place for proxy config. Setting proxy as environment variable didn't help.
Inside the code I see it uses something like pool manager and accepts Configuration class where we can pass proxy config, but maybe there is an easy way to pass proxy config to SDK without changing the code
p
Hello @Dmytro Trofimenko, gooddata python sdk currently does not support proxy configuration directly. We will add it to the list of features for upcoming releases. There is currently no simple workaround. My suggestion is to try the following approach: • Update default configuration used by GD python SDK
Copy code
import gooddata_api_client as api_client

def_config = api_client.Configuration.get_default_copy()
# set proxy configuration
def_config.proxy = "<proxy URL>"
def_config.no_proxy = "<bypass_proxy_host1>,<bypass_proxy_host2>"
def_config.proxy_headers = {"header1": value1, "header2": value2}

# store new default config
api_client.Configuration.set_default(def_config)
• Use pySDK as documented
Copy code
from gooddata_sdk import GoodDataSdk

# GoodData base URL, e.g. "<https://www.example.com>"
host = "<https://www.example.com>"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

# use SDK as required
I did not try the above code so take it as inspiration for your test setup. And please let us know if the above workaround worked for you.
👍 1
d
Thank you