Package schrodinger :: Package utils :: Module urllib
[hide private]
[frames] | no frames]

Module urllib

Classes [hide private]
  PasswordRetryException
  ProxyPasswordManager
  ProxyHandler
A ProxyHandler subclass that loads its proxy configuration from 'web_proxy.json' file in the Schrodinger app data directory.
  ProxyBasicAuthHandler
  ProxyDigestAuthHandler
  MyHTTPHandler
  ProxyTunnelError
  MyHTTPSHandler
Functions [hide private]
 
get_proxy_config_file()
Return the default user proxy config file name.
 
get_opener(password_manager=None)
Return a urllib2.DirectorOpener that deal with proxy tunneling errors and configures its proxy handler from the 'web_proxy.json' file in the Schrodinger app data directory.
 
install_opener()
Install the opener returned by get_opener() as the default opener.
 
do_open(self, http_class, req)
Return an addinfourl object for the request, using http_class.
 
__init__(self, *args, **kwargs)
 
_set_tunnel(self, host, port=None, headers=None)
Sets up the host and the port for the HTTP CONNECT Tunnelling.
 
get_authorization(self, req, chal)
 
_tunnel(self)
Variables [hide private]
  __doc__ = ...
  config_filename = "web_proxy.json"
  _orig_init = httplib.HTTPConnection.__init__
  HTTPSHandler = urllib2.HTTPSHandler
Function Details [hide private]

get_proxy_config_file()

 

Return the default user proxy config file name.

This is the file web_proxy.json in the user's app data directory.

do_open(self, http_class, req)

 

Return an addinfourl object for the request, using http_class.

http_class must implement the HTTPConnection API from httplib. The addinfourl return value is a file-like object. It also has methods and attributes including:

  • info(): return a mimetools.Message object for the headers
  • geturl(): return the original request URL
  • code: HTTP status code

_set_tunnel(self, host, port=None, headers=None)

 

Sets up the host and the port for the HTTP CONNECT Tunnelling.

The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request.


Variables Details [hide private]

__doc__

Value:
"""
Functions that help access web URLs through proxy servers.

This module has two main user-facing functions:

    1. get_opener - Returns a urllib2.OpenerDirector object that is
       configured to read proxy information from the Schrodinger
       configuration file. This OpenerDirector object also deals with
...