Python fetch series behind corporate proxy

Hello, I am trying to retrieve data behind a corporate proxy. I read on the docs that Python dbnomics uses requests so I tried the following:

proxies = {“http”: “http://user:pass@ip:port”,
“https”: “https://user:pass@ip:port”}

s = requests.Session()
s.proxies.update(proxies)
s.verify = False

fetch_series(‘AMECO/ZUTN/EA19.1.0.0.0.ZUTN’)

But I am getting the next error:

SSLError: HTTPSConnectionPool(host=‘api.db.nomics.world’, port=443): Max retries exceeded with url: /v22/series?observations=1&series_ids=AMECO/ZUTN/EA19.1.0.0.0.ZUTN&offset=0 (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)’)))

Thank you in advance,

Javier

Hi Javier,

The thing is, I think, you create a requests Session instance with your proxy params, but it is not used by the dbnomics package.

According to requests documentation, you can define a global proxy configuration using environment variables:

export HTTP_PROXY="http://user:pass@ip:port"
export HTTPS_PROXY="https://user:pass@ip:port"
python myscript.py

Then in myscript.py, requests will see the proxy already configured for its default session.

1 Like