Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using pubchempy / urllib behind proxy #11

Closed
timothymillar opened this issue Apr 6, 2016 · 1 comment
Closed

Using pubchempy / urllib behind proxy #11

timothymillar opened this issue Apr 6, 2016 · 1 comment
Milestone

Comments

@timothymillar
Copy link

I'm using PubChem from behind a proxy (Research institute).
I ran into error Errno 65:

>>> import pubchempy as pug
>>> compound = pug.Compound.from_cid(1423)
...
URLError: <urlopen error [Errno 65] No route to host>

A relatively simple fix is to specify proxy information via urllib:

>>> import urllib
>>> import pubchempy as pug
>>> proxies = {'http': 'http://<proxy.address>:<port>',
...            'https': 'https://<proxy.address>:<port>'}
>>> proxy_support = urllib.request.ProxyHandler(proxies)
>>> opener = urllib.request.build_opener(proxy_support)
>>> urllib.request.install_opener(opener)
>>> compound = pug.Compound.from_cid(1423)
>>> compound
Compound(1423)

The issue is that there is no mention of specifying proxy information in the PubChem documentation.
Addressing this in your documentation (even just a link to the urllib docs) could save others a lot of time.

@mcs07 mcs07 closed this as completed in 77f2d6d Jun 5, 2016
@mcs07
Copy link
Owner

mcs07 commented Jun 5, 2016

Thanks for the tip!

@mcs07 mcs07 modified the milestone: v1.0.4 Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants