-
<c       s  d  Z  d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k	 Z	 d k
 Z
 d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z y d k l Z Wn  e j
 o d k l Z n Xy d k Z Wn e j
 o e Z n Xd k l Z l Z l Z l Z l Z l Z l Z l  Z  l! Z! l" Z" l# Z# d k l$ Z$ d k l% Z% l& Z& d Z' e a( e d  Z) d   Z* d	 e+ f d
     YZ, d e, e f d     YZ- d e, f d     YZ. d f  d     YZ/ d f  d     YZ0 d   Z1 d f  d     YZ2 d e2 f d     YZ3 d e2 f d     YZ4 d e2 f d     YZ5 d f  d     YZ6 d e2 f d     YZ7 d  f  d!     YZ8 d" e8 f d#     YZ9 d$ f  d%     YZ: d& e: e2 f d'     YZ; d( e: e2 f d)     YZ< d* f  d+     YZ= d, e2 e= f d-     YZ> d. e2 e= f d/     YZ? d0   Z@ d1 e2 f d2     YZA d3 eA f d4     YZB eC e d5  o d6 eA f d7     YZD n d8 e2 f d9     YZE d:   ZF d;   ZG d< e2 f d=     YZH d> e2 f d?     YZI d@ eI f dA     YZJ dB e2 f dC     YZK dD f  dE     YZL eM dF j o`e iN   dG j o
 dH Z% n$ e iN   dI j o
 dJ Z% n e Z% dK dL dM dN dO dP dQ dR dS dT f dU dV g ZO eJ   ZP eP iQ dW  e* e1 eP eK   x eO D] ZR eS eR e iT  o eR \ ZR ZU n e ZU eR GHy e) eR eU  ZV Wn> e+ j
 o ZW dX GeW GHnG e iX j
 o ZW dY GeW GHn' XeV iY   ZZ eV i[   dZ e\ eZ  GHHe i] d[  qWn d S(\   s
  An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below).  It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirectory manages a collection of Handler objects that do
all the actual work.  Each Handler implements a particular protocol or
option.  The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL.  For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns.  The HTTPRedirectHandler automatically deals with
HTTP 301 & 302 redirect errors, and the HTTPDigestAuthHandler deals
with digest authentication.

urlopen(url, data=None) -- basic usage is that same as original
urllib.  pass the url and optionally data to post to an HTTP URL, and
get a file-like object back.  One difference is that you can also pass
a Request instance instead of URL.  Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- function that creates a new OpenerDirector instance.
will install the default handlers.  accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.  if one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- installs a new opener as the default opener.

objects of interest:
OpenerDirector --

Request -- an object that encapsulates the state of a request.  the
state can be a simple as the URL.  it can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

exceptions:
URLError-- a subclass of IOError, individual protocols have their own
specific subclass

HTTPError-- also a valid HTTP response, so you can treat an HTTP error
as an exceptional event or valid response

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib2

# set up authentication info
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('realm', 'host', 'username', 'password')

proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler)

# install it
urllib2.install_opener(opener)

f = urllib2.urlopen('http://www.python.org/')


N(   s   StringIO(   s   unwraps   unquotes	   splittypes	   splithosts
   addinfourls	   splitports   splitgophertypes
   splitquerys	   splitattrs
   ftpwrappers	   noheaders(   s
   getproxies(   s	   localhosts   url2pathnames   2.0a1c    s.   t  t j o t   a  n t  i |  |  Sd  S(   N(   s   _openers   Nones   build_openers   opens   urls   data(   s   urls   data(    (    s   /usr/lib/python2.2/urllib2.pys   urlopen s     c    s
   |  a d  S(   N(   s   openers   _opener(   s   opener(    (    s   /usr/lib/python2.2/urllib2.pys   install_opener s     s   URLErrorc      s   t  Z d   Z d   Z RS(   Nc    s   | |  _  d  S(   N(   s   reasons   self(   s   selfs   reason(    (    s   /usr/lib/python2.2/urllib2.pys   __init__ s    c    s   d |  i Sd  S(   Ns   <urlopen error %s>(   s   selfs   reason(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __str__ s    (   s   __name__s
   __module__s   __init__s   __str__(    (    (    s   /usr/lib/python2.2/urllib2.pys   URLError s   	s	   HTTPErrorc      s2   t  Z d  Z e i Z d   Z d   Z d   Z RS(   sB   Raised when HTTP error occurs, but also acts like non-error returnc    sD   |  i | | |  | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   s   selfs   _HTTPError__super_inits   fps   hdrss   urls   codes   msgs   filename(   s   selfs   urls   codes   msgs   hdrss   fp(    (    s   /usr/lib/python2.2/urllib2.pys   __init__ s    				c    s   d |  i |  i f Sd  S(   Ns   HTTP Error %s: %s(   s   selfs   codes   msg(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __str__ s    c    s   |  i o |  i i   n d  S(   N(   s   selfs   fps   close(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __del__ s    
(   s   __name__s
   __module__s   __doc__s
   addinfourls   __init__s   _HTTPError__super_inits   __str__s   __del__(    (    (    s   /usr/lib/python2.2/urllib2.pys	   HTTPError s
    				s   GopherErrorc      s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s   /usr/lib/python2.2/urllib2.pys   GopherError s   s   Requestc      sq   t  Z e h  d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z RS(   Nc    sP   t  |  |  _ t |  _ t |  _ t |  _ | |  _ h  |  _	 |  i	 i
 |  d  S(   N(   s   unwraps   urls   selfs   _Request__originals   Nones   types   hosts   ports   datas   headerss   update(   s   selfs   urls   datas   headers(    (    s   /usr/lib/python2.2/urllib2.pys   __init__ s    					c    se   | d  d j oG | d } t t d |  o% t |  d |    t |  |  Sn n t |  d  S(   Ni   s   _Request__r_s   get_(   s   attrs   names   hasattrs   Requests   getattrs   selfs   AttributeError(   s   selfs   attrs   name(    (    s   /usr/lib/python2.2/urllib2.pys   __getattr__ s    
c    s   | |  _  d  S(   N(   s   datas   self(   s   selfs   data(    (    s   /usr/lib/python2.2/urllib2.pys   add_data s    c    s   |  i t j	 Sd  S(   N(   s   selfs   datas   None(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   has_data s    c    s   |  i Sd  S(   N(   s   selfs   data(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   get_data s    c    s   |  i Sd  S(   N(   s   selfs   _Request__original(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   get_full_url s    c    s^   |  i t j oC t |  i  \ |  _ |  _ |  i t j o t d |  i  n n |  i Sd  S(   Ns   unknown url type: %s(   s   selfs   types   Nones	   splittypes   _Request__originals   _Request__r_types
   ValueError(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   get_type s
    c    sZ   |  i t j o? t |  i  \ |  _ |  _ |  i o t |  i  |  _ n n |  i Sd  S(   N(   s   selfs   hosts   Nones	   splithosts   _Request__r_types   _Request__r_hosts   unquote(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   get_host s
    
c    s   |  i Sd  S(   N(   s   selfs   _Request__r_host(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   get_selector s    c    s(   | | f \ |  _  |  _ |  i |  _ d  S(   N(   s   hosts   types   selfs   _Request__originals   _Request__r_host(   s   selfs   hosts   type(    (    s   /usr/lib/python2.2/urllib2.pys	   set_proxy s    c    s   | |  i | <d  S(   N(   s   vals   selfs   headerss   key(   s   selfs   keys   val(    (    s   /usr/lib/python2.2/urllib2.pys
   add_header s    (   s   __name__s
   __module__s   Nones   __init__s   __getattr__s   add_datas   has_datas   get_datas   get_full_urls   get_types   get_hosts   get_selectors	   set_proxys
   add_header(    (    (    s   /usr/lib/python2.2/urllib2.pys   Request s   									s   OpenerDirectorc      sJ   t  Z d   Z d   Z d   Z d   Z d   Z e d  Z d   Z	 RS(   Nc    s;   d t  } d | f g |  _ g  |  _ h  |  _ h  |  _ d  S(   Ns   Python-urllib/%ss
   User-agent(   s   __version__s   server_versions   selfs
   addheaderss   handlerss   handle_opens   handle_error(   s   selfs   server_version(    (    s   /usr/lib/python2.2/urllib2.pys   __init__ s
    
		c 
   s  d } xit |  D][}	 |	 d d j oR |	 d  } |  i i |  o |  i | i |  n | g |  i | <d } q n |	 i	 d  } |	 | d i	 d  | d } | d j o |	 | d | !d j o |	 |  } |	 | d } y t |  } Wn t j
 o n X|  i i | h   } | i |  o | | i |  n | g | | <| |  i | <d } q n q W| o! |  i i |  | i |   n d  S(   Ni    is   _openi   s   _is   error(   s   addeds   dirs   handlers   meths   protocols   selfs   handle_opens   has_keys   appends   finds   is   js   protos   kinds   ints
   ValueErrors   handle_errors   gets   dicts   handlerss
   add_parent(
   s   selfs   handlers   kinds   addeds   protocols   protos   js   is   dicts   meth(    (    s   /usr/lib/python2.2/urllib2.pys   add_handler s:     
%
c    s   |  i   d  S(   N(   s   selfs   close(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __del__s    c    s+   x |  i D] } | i   q
 Wg  |  _ d  S(   N(   s   selfs   handlerss   handlers   close(   s   selfs   handler(    (    s   /usr/lib/python2.2/urllib2.pys   close!s    
 c 	   sW   | i | f   } x> | D]6 } t | |  } | |   } | t
 j	 o | Sn q Wd  S(   N(   s   chains   gets   kinds   handlerss   handlers   getattrs	   meth_names   funcs   argss   results   None(	   s   selfs   chains   kinds	   meth_names   argss   handlerss   handlers   results   func(    (    s   /usr/lib/python2.2/urllib2.pys   _call_chain&s     c    s   t  | t i t i f  o t | |  } n% | } | t j	 o | i	 |  n |  i |  i d d |  } | o | Sn | i   } |  i |  i | | d |  } | o | Sn |  i |  i d d |  Sd  S(   Ns   defaults   default_opens   _opens   unknowns   unknown_open(   s
   isinstances   fullurls   typess
   StringTypes   UnicodeTypes   Requests   datas   reqs   Nones   add_datas   selfs   _call_chains   handle_opens   results   get_types   type_(   s   selfs   fullurls   datas   type_s   results   req(    (    s   /usr/lib/python2.2/urllib2.pys   open1s"     	c    s   | d d g j o1 |  i d } | d } d | } d } | } n |  i } | d } d } | | | f | } |  i |   } | o | Sn | o$ | d d	 f | } |  i |   Sn d  S(
   Ns   https   httpsi   s   http_error_%di   s   _errori    s   defaults   http_error_default(
   s   protos   selfs   handle_errors   dicts   argss	   meth_names   http_errs	   orig_argss   _call_chains   result(   s   selfs   protos   argss	   orig_argss   http_errs   results   dicts	   meth_name(    (    s   /usr/lib/python2.2/urllib2.pys   errorIs     


	
(
   s   __name__s
   __module__s   __init__s   add_handlers   __del__s   closes   _call_chains   Nones   opens   error(    (    (    s   /usr/lib/python2.2/urllib2.pys   OpenerDirector s   		 			c     sE  t    } t t t t t t t g } t
 t d  o | i t  n g  } xu | D]m } xd |  D]\ } t i |  o% t | |  o | i |  n n" t | |  o | i |  n q_ WqR Wx | D] } | i |  q Wx | D] } | i |    q Wx8 |  D]0 } t i |  o |   } n | i |  q	W| Sd S(   sn  Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP and FTP.  If there is a ProxyHandler, it must be at the
    front of the list of handlers.  (Yuck.)

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    s   HTTPSN(   s   OpenerDirectors   openers   ProxyHandlers   UnknownHandlers   HTTPHandlers   HTTPDefaultErrorHandlers   HTTPRedirectHandlers
   FTPHandlers   FileHandlers   default_classess   hasattrs   httplibs   appends   HTTPSHandlers   skips   klasss   handlerss   checks   inspects   isclasss
   issubclasss
   isinstances   removes   add_handlers   h(   s   handlerss   hs   openers   skips   default_classess   klasss   check(    (    s   /usr/lib/python2.2/urllib2.pys   build_openercs6    	 	     s   BaseHandlerc      s   t  Z d   Z d   Z RS(   Nc    s   | |  _  d  S(   N(   s   parents   self(   s   selfs   parent(    (    s   /usr/lib/python2.2/urllib2.pys
   add_parents    c    s   t  |  _ d  S(   N(   s   Nones   selfs   parent(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   closes    (   s   __name__s
   __module__s
   add_parents   close(    (    (    s   /usr/lib/python2.2/urllib2.pys   BaseHandlers   	s   HTTPDefaultErrorHandlerc      s   t  Z d   Z RS(   Nc    s"   t  | i   | | | |   d  S(   N(   s	   HTTPErrors   reqs   get_full_urls   codes   msgs   hdrss   fp(   s   selfs   reqs   fps   codes   msgs   hdrs(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_defaults    (   s   __name__s
   __module__s   http_error_default(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPDefaultErrorHandlers   s   HTTPRedirectHandlerc      s   t  Z d   Z e Z d Z RS(   Nc    s*  | i d  o | d } n# | i d  o | d } n d  St i | i   |  } t | | i   | i   } h  | _
 t | d  oi t | i
  d j p | i
 i |  o) t | i   | |  i | | |   n | i
 i | i
  n | | i
 | <| i   | i   |  i i |  Sd  S(   Ns   locations   uris   error_302_dicti
   (   s   headerss   has_keys   newurls   urlparses   urljoins   reqs   get_full_urls   Requests   get_datas   news   error_302_dicts   hasattrs   lens	   HTTPErrors   codes   selfs   inf_msgs   msgs   fps   updates   reads   closes   parents   open(   s   selfs   reqs   fps   codes   msgs   headerss   newurls   new(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_302s"    	)

sn   The HTTP server returned a redirect error that wouldlead to an infinite loop.
The last 302 error message was:
(   s   __name__s
   __module__s   http_error_302s   http_error_301s   inf_msg(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPRedirectHandlers   	s   ProxyHandlerc      s   t  Z e d  Z d   Z RS(   Nc    sg   | t j o t   } n | |  _  x= | i   D]/ \ } } t |  d | | | |  i d   q0 Wd  S(   Ns   %s_openc    s   | |  | |  S(   N(   s   meths   rs   proxys   type(   s   rs   proxys   types   meth(    (    s   /usr/lib/python2.2/urllib2.pys   <lambda>s    (	   s   proxiess   Nones
   getproxiess   selfs   itemss   types   urls   setattrs
   proxy_open(   s   selfs   proxiess   urls   type(    (    s   /usr/lib/python2.2/urllib2.pys   __init__s     	 c 	   s   | i   } t |  \ } } t |  \ } } d | j oK | i
 d d  \ } } t i t |   i   } | i d d |  n t |  } | i | |  | | j o t Sn |  i i |  Sd  S(   Ns   @i   s   Proxy-Authorizations   Basic (   s   reqs   get_types	   orig_types	   splittypes   proxys   types   r_types	   splithosts   hosts   XXXs   splits	   user_passs   base64s   encodestrings   unquotes   strips
   add_headers	   set_proxys   Nones   selfs   parents   open(	   s   selfs   reqs   proxys   types	   orig_types   XXXs   hosts	   user_passs   r_type(    (    s   /usr/lib/python2.2/urllib2.pys
   proxy_opens    (   s   __name__s
   __module__s   Nones   __init__s
   proxy_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   ProxyHandlers   
s   CustomProxyc      s)   t  Z e e d  Z d   Z d   Z RS(   Nc    s   | |  _  | |  _ | |  _ d  S(   N(   s   protos   selfs   funcs
   proxy_addrs   addr(   s   selfs   protos   funcs
   proxy_addr(    (    s   /usr/lib/python2.2/urllib2.pys   __init__s    		c    s&   |  i o |  i |  o d Sn d  S(   Ni   (   s   selfs   funcs   req(   s   selfs   req(    (    s   /usr/lib/python2.2/urllib2.pys   handles    c    s   |  i Sd  S(   N(   s   selfs   addr(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys	   get_proxys    (   s   __name__s
   __module__s   Nones   __init__s   handles	   get_proxy(    (    (    s   /usr/lib/python2.2/urllib2.pys   CustomProxys   	s   CustomProxyHandlerc      s,   t  Z d   Z d   Z d   Z d   Z RS(   Nc    s   h  |  _ d  S(   N(   s   selfs   proxies(   s   selfs   proxies(    (    s   /usr/lib/python2.2/urllib2.pys   __init__s    c    s   | i   } y |  i | } Wn t j
 o t Sn XxE | D]= } | i |  o' | i	 | i
    |  i i |  Sn q> Wt Sd  S(   N(   s   reqs   get_types   protos   selfs   proxiess   KeyErrors   Nones   ps   handles	   set_proxys	   get_proxys   parents   open(   s   selfs   reqs   ps   proxiess   proto(    (    s   /usr/lib/python2.2/urllib2.pys
   proxy_opens    	 c    s   |  i i |  Sd  S(   N(   s   selfs   parents   opens   req(   s   selfs   ps   req(    (    s   /usr/lib/python2.2/urllib2.pys   do_proxys    c    sH   |  i i | i  o |  i | i i |  n | g |  i | i <d  S(   N(   s   selfs   proxiess   has_keys   cpos   protos   append(   s   selfs   cpo(    (    s   /usr/lib/python2.2/urllib2.pys	   add_proxys    (   s   __name__s
   __module__s   __init__s
   proxy_opens   do_proxys	   add_proxy(    (    (    s   /usr/lib/python2.2/urllib2.pys   CustomProxyHandlers   			s   HTTPPasswordMgrc      s5   t  Z d   Z d   Z d   Z d   Z d   Z RS(   Nc    s   h  |  _ d  S(   N(   s   selfs   passwd(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __init__s    c    s   t  | t i t i f  o | g } n t t |  i |   } |  i	 i
 |  o h  |  i	 | <n | | f |  i	 | | <d  S(   N(   s
   isinstances   uris   typess
   StringTypes   UnicodeTypes   tuples   maps   selfs
   reduce_uris   passwds   has_keys   realms   user(   s   selfs   realms   uris   users   passwd(    (    s   /usr/lib/python2.2/urllib2.pys   add_passwords    c    s{   |  i i | h   } |  i |  } xF | i   D]8 \ } } x) | D]! } |  i | |  o | Sn qD Wq1 Wt t f Sd  S(   N(   s   selfs   passwds   gets   realms   domainss
   reduce_uris   authuris   itemss   uriss   authinfos   uris	   is_suburis   None(   s   selfs   realms   authuris   authinfos   domainss   uriss   uri(    (    s   /usr/lib/python2.2/urllib2.pys   find_user_passwords      c    sI   t  i  |  } | d o | d | d p d f Sn | d d f Sd S(   s9   Accept netloc or URI and extract only the netloc and pathi   i   s   /N(   s   urlparses   uris   parts(   s   selfs   uris   parts(    (    s   /usr/lib/python2.2/urllib2.pys
   reduce_uris
     c    s|   | | j o d Sn | d | d j o d Sn t i | d | d f  } t |  t | d  j o d Sn d Sd S(   sc   Check if test is below base in a URI tree

        Both args must be URIs in reduced form.
        i   i    N(   s   bases   tests	   posixpaths   commonprefixs   commons   len(   s   selfs   bases   tests   common(    (    s   /usr/lib/python2.2/urllib2.pys	   is_suburi s     (   s   __name__s
   __module__s   __init__s   add_passwords   find_user_passwords
   reduce_uris	   is_suburi(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPPasswordMgrs
   						s   HTTPPasswordMgrWithDefaultRealmc      s   t  Z d   Z RS(   Nc    sM   t  i |  | |  \ } } | t j	 o | | f Sn t  i |  t |  Sd  S(   N(   s   HTTPPasswordMgrs   find_user_passwords   selfs   realms   authuris   users   passwords   None(   s   selfs   realms   authuris   users   password(    (    s   /usr/lib/python2.2/urllib2.pys   find_user_password1s    (   s   __name__s
   __module__s   find_user_password(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPPasswordMgrWithDefaultRealm/s   s   AbstractBasicAuthHandlerc      s5   t  Z e i d  Z e d  Z d   Z d   Z RS(   Ns!   [ 	]*([^ 	]+)[ 	]+realm="([^"]*)"c    s6   | t j o t   } n | |  _ |  i i |  _ d  S(   N(   s   password_mgrs   Nones   HTTPPasswordMgrs   selfs   passwds   add_password(   s   selfs   password_mgr(    (    s   /usr/lib/python2.2/urllib2.pys   __init__@s    	c    sz   | i | t  } | o] t i i |  } | o@ | i   \ } } | i   d j o |  i | | |  Sn n n d  S(   Ns   basic(   s   headerss   gets   authreqs   Nones   AbstractBasicAuthHandlers   rxs   matchs   mos   groupss   schemes   realms   lowers   selfs   retry_http_basic_auths   hosts   req(   s   selfs   authreqs   hosts   reqs   headerss   schemes   mos   realm(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_auth_reqedFs    c    s   |  i i | |  \ } } | ow d | | f } d t i	 |  i
   } | i i |  i t  | j o t Sn | i |  i |  |  i i |  Sn t Sd  S(   Ns   %s:%ss   Basic %s(   s   selfs   passwds   find_user_passwords   realms   hosts   users   pws   raws   base64s   encodestrings   strips   auths   reqs   headerss   gets   auth_headers   Nones
   add_headers   parents   open(   s   selfs   hosts   reqs   realms   raws   pws   auths   user(    (    s   /usr/lib/python2.2/urllib2.pys   retry_http_basic_authPs    (	   s   __name__s
   __module__s   res   compiles   rxs   Nones   __init__s   http_error_auth_reqeds   retry_http_basic_auth(    (    (    s   /usr/lib/python2.2/urllib2.pys   AbstractBasicAuthHandler8s   	
s   HTTPBasicAuthHandlerc      s   t  Z d Z d   Z RS(   Ns   Authorizationc    s3   t  i  | i    d } |  i d | | |  Sd  S(   Ni   s   www-authenticate(   s   urlparses   reqs   get_full_urls   hosts   selfs   http_error_auth_reqeds   headers(   s   selfs   reqs   fps   codes   msgs   headerss   host(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_401`s    	(   s   __name__s
   __module__s   auth_headers   http_error_401(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPBasicAuthHandler\s   s   ProxyBasicAuthHandlerc      s   t  Z d Z d   Z RS(   Ns   Proxy-Authorizationc    s&   | i   } |  i d | | |  Sd  S(   Ns   proxy-authenticate(   s   reqs   get_hosts   hosts   selfs   http_error_auth_reqeds   headers(   s   selfs   reqs   fps   codes   msgs   headerss   host(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_407js    	(   s   __name__s
   __module__s   auth_headers   http_error_407(    (    (    s   /usr/lib/python2.2/urllib2.pys   ProxyBasicAuthHandlerfs   s   AbstractDigestAuthHandlerc      sA   t  Z e d  Z d   Z d   Z d   Z d   Z d   Z RS(   Nc    s6   | t j o t   } n | |  _  |  i  i |  _ d  S(   N(   s   passwds   Nones   HTTPPasswordMgrs   selfs   add_password(   s   selfs   passwd(    (    s   /usr/lib/python2.2/urllib2.pys   __init__rs    	c    sU   | i |  i t  } | o5 | i   d } | d j o |  i | |  Sn n d  S(   Ni    s   Digest(
   s   headerss   gets   selfs   auth_headers   Nones   authreqs   splits   kinds   retry_http_digest_auths   req(   s   selfs   authreqs   hosts   reqs   headerss   kind(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_auth_reqedxs
    c    s   | i d d  \ } } t t |   } |  i | |  } | o^ d | } | i i |  i t  | j o t Sn | i |  i |  |  i i |  } | Sn d  S(   Ns    i   s	   Digest %s(   s   auths   splits   tokens	   challenges   parse_keqv_lists   parse_http_lists   chals   selfs   get_authorizations   reqs   auth_vals   headerss   gets   auth_headers   Nones
   add_headers   parents   opens   resp(   s   selfs   reqs   auths	   challenges   resps   tokens   chals   auth_val(    (    s   /usr/lib/python2.2/urllib2.pys   retry_http_digest_auths    
c    s  y< | d } | d } | i d d  } | i d t  }	 Wn t j
 o t Sn X|  i	 |  \ } } | t j o t Sn |  i i | | i    \ } } | t j o t Sn | i   o |  i | i   |  } n t } d | | | f }
 d | i   o d p d	 | i   f } | | |
  d | | |  f  } d
 | | | | i   | f } |	 o | d |	 } n | o | d | } n | d j o | d | } n | Sd  S(   Ns   realms   nonces	   algorithms   MD5s   opaques   %s:%s:%ss   %s:%ss   POSTs   GETs>   username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s   , opaque="%s"s   , digest="%s"s   , algorithm="%s"(   s   chals   realms   nonces   gets	   algorithms   Nones   opaques   KeyErrors   selfs   get_algorithm_implss   Hs   KDs   passwds   find_user_passwords   reqs   get_full_urls   users   pws   has_datas   get_entity_digests   get_datas   entdigs   A1s   get_selectors   A2s   respdigs   base(   s   selfs   reqs   chals   nonces   realms   pws	   algorithms   KDs   Hs   opaques   A1s   A2s   users   bases   respdigs   entdig(    (    s   /usr/lib/python2.2/urllib2.pys   get_authorizations8    

	*%c    sT   | d j o t d  } n | d j o t d  } n | d  } | | f Sd  S(   Ns   MD5c    s   | t i |   i    S(   N(   s   es   md5s   news   xs   digest(   s   xs   e(    (    s   /usr/lib/python2.2/urllib2.pys   <lambda>s    s   SHAc    s   | t i |   i    S(   N(   s   es   shas   news   xs   digest(   s   xs   e(    (    s   /usr/lib/python2.2/urllib2.pys   <lambda>s    c    s   | d |  | f  S(   Ns   %s:%s(   s   Hs   ss   d(   s   ss   ds   H(    (    s   /usr/lib/python2.2/urllib2.pys   <lambda>s    (   s	   algorithms   encode_digests   Hs   KD(   s   selfs	   algorithms   Hs   KD(    (    s   /usr/lib/python2.2/urllib2.pys   get_algorithm_implss    c    s   t  Sd  S(   N(   s   None(   s   selfs   datas   chal(    (    s   /usr/lib/python2.2/urllib2.pys   get_entity_digests    (	   s   __name__s
   __module__s   Nones   __init__s   http_error_auth_reqeds   retry_http_digest_auths   get_authorizations   get_algorithm_implss   get_entity_digest(    (    (    s   /usr/lib/python2.2/urllib2.pys   AbstractDigestAuthHandlerps   			,	
s   HTTPDigestAuthHandlerc      s   t  Z d  Z d Z d   Z RS(   s   An authentication protocol defined by RFC 2069

    Digest authentication improves on basic authentication because it
    does not transmit passwords in the clear.
    s   Authorizationc    s3   t  i  | i    d } |  i d | | |  d  S(   Ni   s   www-authenticate(   s   urlparses   reqs   get_full_urls   hosts   selfs   http_error_auth_reqeds   headers(   s   selfs   reqs   fps   codes   msgs   headerss   host(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_401s    (   s   __name__s
   __module__s   __doc__s   headers   http_error_401(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPDigestAuthHandlers    s   ProxyDigestAuthHandlerc      s   t  Z d Z d   Z RS(   Ns   Proxy-Authorizationc    s&   | i   } |  i d | | |  d  S(   Ns   proxy-authenticate(   s   reqs   get_hosts   hosts   selfs   http_error_auth_reqeds   headers(   s   selfs   reqs   fps   codes   msgs   headerss   host(    (    s   /usr/lib/python2.2/urllib2.pys   http_error_407s    (   s   __name__s
   __module__s   headers   http_error_407(    (    (    s   /usr/lib/python2.2/urllib2.pys   ProxyDigestAuthHandlers   c    sz   g  } x` |  D]X } t |  d ?d @} | i t |  d  t |  d @} | i t |  d  q Wd i |  Sd  S(   Ni   i   is    (   s   hexreps   digests   cs   ords   ns   appends   hexs   join(   s   digests   cs   hexreps   n(    (    s   /usr/lib/python2.2/urllib2.pys   encode_digests     s   AbstractHTTPHandlerc      s   t  Z d   Z RS(   Nc    s  | i   } | o t d   n y | |  } | i   o | i   } | i	 d | i
    | i i d  o | i d d  n | i i d  o | i d d t |   n n | i	 d | i
    Wn$ t i j
 o } t |   n X| i d |  x! |  i i D] } | i |   qWx- | i i   D] \ } } | i | |  qBW| i   | i   o | i |  n | i   \ }	 } }
 | i   } |	 d	 j o t! | |
 | i"    Sn  |  i i d
 | | |	 | |
  Sd  S(   Ns   no host givens   POSTs   Content-types!   application/x-www-form-urlencodeds   Content-lengths   %ds   GETs   Hosti   s   http(#   s   reqs   get_hosts   hosts   URLErrors
   http_classs   hs   has_datas   get_datas   datas
   putrequests   get_selectors   headerss   has_keys	   putheaders   lens   sockets   errors   errs   selfs   parents
   addheaderss   argss   itemss   ks   vs
   endheaderss   sends   getreplys   codes   msgs   hdrss   getfiles   fps
   addinfourls   get_full_url(   s   selfs
   http_classs   reqs   fps   errs   hs   argss   vs   hosts   codes   hdrss   msgs   datas   k(    (    s   /usr/lib/python2.2/urllib2.pys   do_opens>    	"  
(   s   __name__s
   __module__s   do_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   AbstractHTTPHandlers   s   HTTPHandlerc      s   t  Z d   Z RS(   Nc    s   |  i t i |  Sd  S(   N(   s   selfs   do_opens   httplibs   HTTPs   req(   s   selfs   req(    (    s   /usr/lib/python2.2/urllib2.pys	   http_opens    (   s   __name__s
   __module__s	   http_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPHandlers   s   HTTPSs   HTTPSHandlerc      s   t  Z d   Z RS(   Nc    s   |  i t i |  Sd  S(   N(   s   selfs   do_opens   httplibs   HTTPSs   req(   s   selfs   req(    (    s   /usr/lib/python2.2/urllib2.pys
   https_opens    (   s   __name__s
   __module__s
   https_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   HTTPSHandlers   s   UnknownHandlerc      s   t  Z d   Z RS(   Nc    s    | i   } t d |   d  S(   Ns   unknown url type: %s(   s   reqs   get_types   types   URLError(   s   selfs   reqs   type(    (    s   /usr/lib/python2.2/urllib2.pys   unknown_opens    (   s   __name__s
   __module__s   unknown_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   UnknownHandlers   c    st   h  } xc |  D][ } | i d d  \ } } | d d j o | d d j o | d d !} n | | | <q W| Sd S(   s>   Parse list of key=value strings where keys are not duplicated.s   =i   i    s   "iN(   s   parseds   ls   elts   splits   ks   v(   s   ls   ks   vs   elts   parsed(    (    s   /usr/lib/python2.2/urllib2.pys   parse_keqv_list s      "c 	   s  g  } t |   } d } d } d } xT| | j  oF|  | } | i d  } | i d  } | d j o | i |  |  Pn | d j oA | o t d  n* | i |  | | | ! | | d } q' n | oQ | | j  o6 | i |  | | | ! | | d } | } d } n | | } nR | | j  o0 | i |  | | | ! | | d } | } n d } | | d } q' Wt d   |  Sd S(	   s   Parse lists as described by RFC 2068 Section 2.

    In particular, parse comman-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.
    i    s   ,s   "is   unbalanced quotesi   c    s
   |  i   S(   N(   s   xs   strip(   s   x(    (    s   /usr/lib/python2.2/urllib2.pys   <lambda>Vs    N(   s   lists   lens   ss   ends   is   inquotes   starts   curs   finds   cs   qs   appends
   ValueErrors   map(	   s   ss   cs   ends   curs   is   lists   qs   starts   inquote(    (    s   /usr/lib/python2.2/urllib2.pys   parse_http_list*sD      


s   FileHandlerc      s)   t  Z d   Z e Z d   Z d   Z RS(   Nc    s_   | i   } | d  d j o | d d !d j o d | _ |  i i |  Sn |  i |  Sd  S(   Ni   s   //i   s   /s   ftp(   s   reqs   get_selectors   urls   types   selfs   parents   opens   open_local_file(   s   selfs   reqs   url(    (    s   /usr/lib/python2.2/urllib2.pys	   file_openZs
    %	c    sF   t  i t j o+ t i d  t i t i    f t  _ n t  i Sd  S(   Ns	   localhost(   s   FileHandlers   namess   Nones   sockets   gethostbynames   gethostname(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys	   get_namesds    +c    s  | i   } | i   } t |  }
 t i |
  } | t i
 }	 t i | t i  } t i |  d } t i |
  } t i t d | p d |	 | f   } | o t |  \ } } n | p! | o t i |  |  i   j o! t t |
 d  | d |  Sn t d   d  S(   Ni    s6   Content-Type: %s
Content-Length: %d
Last-modified: %s
s
   text/plains   rbs   file:s   file not on local host(    s   reqs   get_hosts   hosts   get_selectors   files   url2pathnames	   localfiles   oss   stats   statss   ST_SIZEs   sizes   rfc822s
   formatdates   ST_MTIMEs   modifieds	   mimetypess
   guess_types   mtypes	   mimetoolss   Messages   StringIOs   headerss	   splitports   ports   sockets   gethostbynames   selfs	   get_namess
   addinfourls   opens   URLError(   s   selfs   reqs   mtypes   hosts   files   ports   statss   modifieds   headerss   sizes	   localfile(    (    s   /usr/lib/python2.2/urllib2.pys   open_local_fileks    ),(   s   __name__s
   __module__s	   file_opens   Nones   namess	   get_namess   open_local_file(    (    (    s   /usr/lib/python2.2/urllib2.pys   FileHandlerXs   			s
   FTPHandlerc      s   t  Z d   Z d   Z RS(   Nc    s  | i   } | o t d d f  n y t i |  } Wn$ t i j
 o } t |   n Xt	 |  \ } } | t j o t i } n t | i    \ }
 } t |
  }
 |
 i d  } | d  | d f \ } }	 | o	 | d o | d } n d } } yE|  i | | | | |  } |	 o d p d	 } xb | D]Z } t |  \ } } | i   d
 j o | d d d d d d	 f j o | i   } n q>W| i  |	 |  \ } } d } t$ i% | i&    d } | o | d | 7} n | t j	 o
 | d j o | d | 7} n t( |  } t* i+ |  } t, | | | i&    SWn4 t i- j
 o% } t d | f t. i/   d  n Xd  S(   Ns	   ftp errors   no host givens   /ii    i   s    s   Is   Ds   types   as   As   is   ds   Content-Type: %s
s   Content-Length: %d
i   (0   s   reqs   get_hosts   hosts   IOErrors   sockets   gethostbynames   errors   msgs   URLErrors	   splitports   ports   Nones   ftplibs   FTP_PORTs	   splitattrs   get_selectors   paths   attrss   unquotes   splits   dirss   files   users   passwds   selfs   connect_ftps   fws   types   attrs   values   lowers   uppers   retrfiles   fps   retrlens   headerss	   mimetypess
   guess_types   get_full_urls   mtypes   StringIOs   sfs	   mimetoolss   Messages
   addinfourls
   all_errorss   syss   exc_info(   s   selfs   reqs   fws   passwds   mtypes   msgs   hosts   fps   attrss   files   paths   dirss   ports   attrs   values   retrlens   headerss   types   sfs   user(    (    s   /usr/lib/python2.2/urllib2.pys   ftp_opensJ    
 2c    s    t  | | | | |  } | Sd  S(   N(   s
   ftpwrappers   users   passwds   hosts   ports   dirss   fw(   s   selfs   users   passwds   hosts   ports   dirss   fw(    (    s   /usr/lib/python2.2/urllib2.pys   connect_ftps    (   s   __name__s
   __module__s   ftp_opens   connect_ftp(    (    (    s   /usr/lib/python2.2/urllib2.pys
   FTPHandlers   	(s   CacheFTPHandlerc      s5   t  Z d   Z d   Z d   Z d   Z d   Z RS(   Nc    s1   h  |  _ h  |  _ d |  _ d |  _ d |  _ d  S(   Ni    i<   i   (   s   selfs   caches   timeouts   soonests   delays	   max_conns(   s   self(    (    s   /usr/lib/python2.2/urllib2.pys   __init__s
    				c    s   | |  _ d  S(   N(   s   ts   selfs   delay(   s   selfs   t(    (    s   /usr/lib/python2.2/urllib2.pys
   setTimeouts    c    s   | |  _ d  S(   N(   s   ms   selfs	   max_conns(   s   selfs   m(    (    s   /usr/lib/python2.2/urllib2.pys   setMaxConnss    c    s   | | | | f } |  i i |  o t i   |  i	 |  i
 | <n: t | | | | |  |  i | <t i   |  i	 |  i
 | <|  i   |  i | Sd  S(   N(   s   users   passwds   hosts   ports   keys   selfs   caches   has_keys   times   delays   timeouts
   ftpwrappers   dirss   check_cache(   s   selfs   users   passwds   hosts   ports   dirss   key(    (    s   /usr/lib/python2.2/urllib2.pys   connect_ftps    
c    s  t  i    } |  i | j oZ xS |  i i   D]B \ } } | | j  o) |  i | i	   |  i | =|  i | =n q, Wn t
 |  i i    |  _ t |  i  |  i j oe xF |  i i   D]5 \ } } | |  i j o |  i | =|  i | =Pn q Wt
 |  i i    |  _ n d  S(   N(   s   times   ts   selfs   soonests   timeouts   itemss   ks   vs   caches   closes   mins   valuess   lens	   max_conns(   s   selfs   ts   ks   v(    (    s   /usr/lib/python2.2/urllib2.pys   check_caches"     
 

	(   s   __name__s
   __module__s   __init__s
   setTimeouts   setMaxConnss   connect_ftps   check_cache(    (    (    s   /usr/lib/python2.2/urllib2.pys   CacheFTPHandlers
   				
s   GopherHandlerc      s   t  Z d   Z RS(   Nc    s   | i   } | o t d   n t |  } | i   } t |  \ } } t	 |  \ } } t |  } | o% t |  } t i | | |  } n t i | |  } t | t   | i    Sd  S(   Ns   no host given(   s   reqs   get_hosts   hosts   GopherErrors   unquotes   get_selectors   selectors   splitgophertypes   types
   splitquerys   querys	   gopherlibs
   send_querys   fps   send_selectors
   addinfourls	   noheaderss   get_full_url(   s   selfs   reqs   fps   types   selectors   hosts   query(    (    s   /usr/lib/python2.2/urllib2.pys   gopher_opens    (   s   __name__s
   __module__s   gopher_open(    (    (    s   /usr/lib/python2.2/urllib2.pys   GopherHandlers   s   OpenerFactoryc      sY   t  Z e e e e e e g Z e	 g Z
 g  Z g  Z d   Z d   Z d   Z d   Z RS(   Nc    s   |  i | g |  _ d  S(   N(   s   selfs   proxy_handlerss   ph(   s   selfs   ph(    (    s   /usr/lib/python2.2/urllib2.pys   add_proxy_handlers    c    s   |  i | g |  _ d  S(   N(   s   selfs   handlerss   h(   s   selfs   h(    (    s   /usr/lib/python2.2/urllib2.pys   add_handlers    c    s   d  S(   N(    (   s   selfs   h(    (    s   /usr/lib/python2.2/urllib2.pys   replace_handlers    c    sK   t    } x; |  i D]0 } t i |  o |   } n | i |  q Wd  S(   N(   s   OpenerDirectors   openers   selfs   proxy_handlerss   phs   inspects   isclasss   add_handler(   s   selfs   openers   ph(    (    s   /usr/lib/python2.2/urllib2.pys   build_openers    	
 (   s   __name__s
   __module__s   UnknownHandlers   HTTPHandlers   HTTPDefaultErrorHandlers   HTTPRedirectHandlers
   FTPHandlers   FileHandlers   default_handlerss   ProxyHandlers   proxy_handlerss   handlerss   replacement_handlerss   add_proxy_handlers   add_handlers   replace_handlers   build_opener(    (    (    s   /usr/lib/python2.2/urllib2.pys   OpenerFactorys   				s   __main__s	   bitdiddles   bitdiddle.cnri.reston.va.uss   bitdiddle.concentric.nets	   localhosts3   gopher://gopher.lib.ncsu.edu/11/library/stacks/Alexs"   gopher://gopher.vt.edu:10010/10/33s   file:/etc/passwds   file://nonsensename/etc/passwds-   ftp://www.python.org/pub/python/misc/sousa.aus!   ftp://www.python.org/pub/tmp/blats   http://www.espn.com/s)   http://www.python.org/Spanish/Inquistion/s%   http://www.python.org/cgi-bin/faqw.pys:   query=pythonistas&querytype=simple&casefold=yes&req=searchs   http://www.python.org/s[   ftp://gatekeeper.research.compaq.com/pub/DEC/SRC/research-reports/00README-Legal-Rules-Regsi   s   IOError:s   socket.error:s   read %d bytesf0.10000000000000001(^   s   __doc__s   sockets   httplibs   inspects   res   base64s   typess   urlparses   md5s	   mimetypess	   mimetoolss   rfc822s   ftplibs   syss   times   oss   stats	   gopherlibs	   posixpaths	   cStringIOs   StringIOs   ImportErrors   shas   Nones   urllibs   unwraps   unquotes	   splittypes	   splithosts
   addinfourls	   splitports   splitgophertypes
   splitquerys	   splitattrs
   ftpwrappers	   noheaderss
   getproxiess	   localhosts   url2pathnames   __version__s   _openers   urlopens   install_openers   IOErrors   URLErrors	   HTTPErrors   GopherErrors   Requests   OpenerDirectors   build_openers   BaseHandlers   HTTPDefaultErrorHandlers   HTTPRedirectHandlers   ProxyHandlers   CustomProxys   CustomProxyHandlers   HTTPPasswordMgrs   HTTPPasswordMgrWithDefaultRealms   AbstractBasicAuthHandlers   HTTPBasicAuthHandlers   ProxyBasicAuthHandlers   AbstractDigestAuthHandlers   HTTPDigestAuthHandlers   ProxyDigestAuthHandlers   encode_digests   AbstractHTTPHandlers   HTTPHandlers   hasattrs   HTTPSHandlers   UnknownHandlers   parse_keqv_lists   parse_http_lists   FileHandlers
   FTPHandlers   CacheFTPHandlers   GopherHandlers   OpenerFactorys   __name__s   gethostnames   urlss   cfhs
   setTimeouts   urls
   isinstances	   TupleTypes   reqs   fs   errs   errors   reads   bufs   closes   lens   sleep(L   s	   mimetoolss   unquotes
   getproxiess   base64s   errs   cfhs	   splittypes   HTTPPasswordMgrs   BaseHandlers	   mimetypess	   splithosts   bufs   encode_digests   urls   AbstractBasicAuthHandlers
   addinfourls   HTTPDigestAuthHandlers   GopherErrors   HTTPHandlers   install_openers	   splitports	   posixpaths   ProxyBasicAuthHandlers   CustomProxys   unwraps	   noheaderss   FileHandlers   res   HTTPDefaultErrorHandlers   OpenerFactorys   HTTPSHandlers	   splitattrs   __version__s   GopherHandlers   md5s   URLErrors   ftplibs   stats   ProxyDigestAuthHandlers   urlss   fs   rfc822s   urlopens   AbstractDigestAuthHandlers   inspects   Requests   parse_http_lists   syss
   FTPHandlers   OpenerDirectors   HTTPBasicAuthHandlers	   HTTPErrors   splitgophertypes   HTTPRedirectHandlers   typess   url2pathnames
   ftpwrappers   httplibs   CacheFTPHandlers   HTTPPasswordMgrWithDefaultRealms   sockets
   splitquerys   StringIOs   UnknownHandlers   parse_keqv_lists   build_openers   urlparses   shas   ProxyHandlers   CustomProxyHandlers	   localhosts	   gopherlibs   times   AbstractHTTPHandlers   reqs   os(    (    s   /usr/lib/python2.2/urllib2.pys   ?G s   																		I		>n	%(!-	$

V		
'	
	.'..

-!	 
