Enable use of proxies & document its usage
dmpe opened this issue · comments
John commented
Hi @avelkoski,
can we document use of proxies and subsequent use of this python module ?
Or, if necessary, expose ProxyHandler
?
https://github.com/avelkoski/FRB/blob/master/fred/helpers/__init__.py#L141
https://github.com/avelkoski/FRB/blob/master/fred/__init__.py
What I am trying is
import os
import urllib
proxy = 'http://username:password@enterprise proxy/'
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy
Then, which works well
import os
print(os.environ.get('http_proxy'))
print(os.environ.get('https_proxy'))
Then:
from fred import Fred
fred = Fred(api_key='xxx', response_type='dict')
params = {'limit':10}
res = fred.release.tags(51,params=params)
print(res)
fails with <urlopen error [Errno 111] Connection refused>
However, R and Python with different use case but still with proxy do seem to work.
John commented
Would you be willing to review a PR if I provide it ? @avelkoski