[BioPython] Configuring Proxy for certain Modules

Peter biopython at maubp.freeserve.co.uk
Mon Sep 24 16:58:56 UTC 2007


João Rodrigues wrote:
> Hello!
> 
> I am working in a University whose network is proxied. I can't work
> with any of the BioPython modules that require access to the Internet
> (e.g. Bio.WWW). How can I configure them manually to override the
> proxy? I already read about configuring the urllib to use a proxy,
> but I can't figure out where to find the string that handles the
> connection.

Bio.WWW uses urllib, so the simplest answer is to follow the advice in 
http://docs.python.org/lib/module-urllib.html

Specifically on Windows you probably just need to set the http_proxy 
environment variables before starting Python, or configure the proxy in 
the internet settings (via Internet Explorer I assume).  I think would 
be easiest to set this environment variable once by hand, but you could 
set it at run time as part of your python script.

You'll have to consult your Universities network documentation to 
determine the string to use for the http_proxy environment variable, but 
it would look something like "http://www.someproxy.com:3128" (i.e. 
address:port number).

The alternative is to pass the "proxies" option to urllib.openurl(), but 
this would require multiple changes in Bio.WWW to support.  Note that 
urllib does not currently support proxies which require authentication.

Peter




More information about the Biopython mailing list