Closed jarretinha closed 5 days ago
Have you found a way to fetch data through a proxy? The most obvious, but not straightforward solution would be to overwrite the APIRequest, Connection, and ECMWFDataServer objects respectively. If you managed to deliver a working version, could you share it?
@JacobMaciejewski, proxy support should be available, but currently only through environment variables on Unix-based systems, haven't checked on Windows.
That is, one could do something like:
export https_proxy=proxy_url
python my_webapi_script.py
Or:
https_proxy=proxy_url python my_webapi_script.py
Where proxy_url
is the url of your proxy server, which can include authentication information, port, etc., e.g. http://user:pass@domain:port
.
Note that one needs to set https_proxy
since the the ECMWF WebAPI uses https
.
Also note that by default the ecmwf-api-client
should respect any system wide defined proxy environment variables.
Of course, one could do the above directly in Python, before the ecmwf-api-client
specific code:
import os
os.environ["https_proxy"] = "proxy_url"
Let me know if that works for you, I can have another look otherwise.
This is exactly how I resolved the problem. Thanks for the extensive answer, it will help people in the future.
Good to hear. Will look into updating the docs to mention it.
After reading the api code, I wasn´t able to find a place to configure an authenticated proxy. I know urllib2 and urllib.requests have some support for proxies. But, it´s not clear for me the simplest way to add it to the requests. Could you help me find a good spot?