FRB icon indicating copy to clipboard operation
FRB copied to clipboard

Enable use of proxies & document its usage

Open dmpe opened this issue 5 years ago • 1 comments

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.

dmpe avatar Feb 24 '20 10:02 dmpe

Would you be willing to review a PR if I provide it ? @avelkoski

dmpe avatar Mar 01 '20 12:03 dmpe