509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
uWS`c           @   sW  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z y d d l m Z Wn! e k
 rå d d l m Z n Xy d d l Z Wn e k
 re Z n Xe Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ d d l m% Z% m& Z& m' Z' m( Z( e
 j) d  Z* d a, d e	 j- d d e d d „ Z. d „  Z/ d	 e0 f d
 „  ƒ  YZ1 d e1 e f d „  ƒ  YZ2 e j3 d ƒ Z4 d „  Z5 d dD d „  ƒ  YZ6 d dE d „  ƒ  YZ7 d „  Z8 d dF d „  ƒ  YZ9 d e9 f d „  ƒ  YZ: d e9 f d „  ƒ  YZ; d e9 f d „  ƒ  YZ< d „  Z= d e9 f d „  ƒ  YZ> d dG d  „  ƒ  YZ? d! e? f d" „  ƒ  YZ@ d# dH d$ „  ƒ  YZA d% eA e9 f d& „  ƒ  YZB d' eA e9 f d( „  ƒ  YZC d) „  ZD d* dI d+ „  ƒ  YZE d, e9 eE f d- „  ƒ  YZF d. e9 eE f d/ „  ƒ  YZG d0 e9 f d1 „  ƒ  YZH d2 eH f d3 „  ƒ  YZI eJ e d4 ƒ rÊd5 eH f d6 „  ƒ  YZK n  d7 e9 f d8 „  ƒ  YZL d9 e9 f d: „  ƒ  YZM d; „  ZN d< „  ZO d= „  ZP d> e9 f d? „  ƒ  YZQ d@ e9 f dA „  ƒ  YZR dB eR f dC „  ƒ  YZS d S(J   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 OpenerDirector 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, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the 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 -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request.  The
state can be as 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='PDQ Application',
                      uri='https://mahler:8092/site-updates.py',
                      user='klem',
                      passwd='geheim$parole')

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/')


iÿÿÿÿN(   t   StringIO(   t   unwrapt   unquotet	   splittypet	   splithostt   quotet
   addinfourlt	   splitportt   splittagt   toBytest	   splitattrt
   ftpwrappert	   splitusert   splitpasswdt
   splitvalue(   t	   localhostt   url2pathnamet
   getproxiest   proxy_bypassi   c   	      C   sÝ   | s | s | r„ | d  k	 r- t d ƒ ‚ n  t sB t d ƒ ‚ n  t j d t j j d | d | ƒ } t d | ƒ } t | ƒ } nF | r¨ t d | ƒ } t | ƒ } n" t	 d  k rÄ t ƒ  a	 } n t	 } | j
 |  | | ƒ S(   NsD   You can't pass both context and any of cafile, capath, and cadefaults   SSL support not availablet   purposet   cafilet   capatht   context(   t   Nonet
   ValueErrort	   _have_sslt   sslt   create_default_contextt   Purposet   SERVER_AUTHt   HTTPSHandlert   build_openert   _openert   open(	   t   urlt   datat   timeoutR   R   t	   cadefaultR   t   https_handlert   opener(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   urlopenƒ   s$    	c         C   s
   |  a  d  S(   N(   R    (   R'   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   install_openerœ   s    t   URLErrorc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | f |  _  | |  _ d  S(   N(   t   argst   reason(   t   selfR,   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   __init__ª   s    c         C   s   d |  j  S(   Ns   <urlopen error %s>(   R,   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   __str__®   s    (   t   __name__t
   __module__R.   R/   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR*   ¤   s   	t	   HTTPErrorc           B   sA   e  Z d  Z e j Z d „  Z d „  Z e d „  ƒ Z d „  Z	 RS(   sB   Raised when HTTP error occurs, but also acts like non-error returnc         C   sV   | |  _  | |  _ | |  _ | |  _ | |  _ | d  k	 rR |  j | | | | ƒ n  d  S(   N(   t   codet   msgt   hdrst   fpt   filenameR   t   _HTTPError__super_init(   R-   R"   R3   R4   R5   R6   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   µ   s    					c         C   s   d |  j  |  j f S(   Ns   HTTP Error %s: %s(   R3   R4   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR/   Â   s    c         C   s   |  j  S(   N(   R4   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR,   Ç   s    c         C   s   |  j  S(   N(   R5   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   infoË   s    (
   R0   R1   t   __doc__R   R.   R8   R/   t   propertyR,   R9   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR2   ±   s   			s   :\d+$c         C   s_   |  j  ƒ  } t j | ƒ d } | d k r@ |  j d d ƒ } n  t j d | d ƒ } | j ƒ  S(   sˆ   Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    i   t    t   Host(   t   get_full_urlt   urlparset
   get_headert   _cut_port_ret   subt   lower(   t   requestR"   t   host(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   request_hostÐ   s    t   Requestc           B   sÂ   e  Z d i  d e d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z d „  Z RS(   c         C   sÇ   t  | ƒ |  _ t |  j ƒ \ |  _ |  _ d  |  _ d  |  _ d  |  _ d  |  _ | |  _	 i  |  _
 x* | j ƒ  D] \ } } |  j | | ƒ qm Wi  |  _ | d  k r± t |  ƒ } n  | |  _ | |  _ d  S(   N(   R   t   _Request__originalR   t   _Request__fragmentR   t   typeRE   t   portt   _tunnel_hostR#   t   headerst   itemst
   add_headert   unredirected_hdrsRF   t   origin_req_hostt   unverifiable(   R-   R"   R#   RM   RQ   RR   t   keyt   value(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   â   s    								c         C   s<   | d k r/ t  |  d | d ƒ ƒ  |  j | St | ‚ d  S(   Nt   _Request__r_typet   _Request__r_hostt   get_i   (   RU   RV   (   t   getattrt   __dict__t   AttributeError(   R-   t   attr(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   __getattr__ö   s    c         C   s   |  j  ƒ  r d Sd Sd  S(   Nt   POSTt   GET(   t   has_data(   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt
   get_method   s    c         C   s   | |  _  d  S(   N(   R#   (   R-   R#   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   add_data  s    c         C   s   |  j  d  k	 S(   N(   R#   R   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR_     s    c         C   s   |  j  S(   N(   R#   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   get_data  s    c         C   s(   |  j  r d |  j |  j  f S|  j Sd  S(   Ns   %s#%s(   RI   RH   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR>     s    	c         C   sV   |  j  d  k rO t |  j ƒ \ |  _  |  _ |  j  d  k rO t d |  j ‚ qO n  |  j  S(   Ns   unknown url type: %s(   RJ   R   R   RH   RU   R   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   get_type  s
    c         C   sR   |  j  d  k rK t |  j ƒ \ |  _  |  _ |  j  rK t |  j  ƒ |  _  qK n  |  j  S(   N(   RE   R   R   RU   RV   R   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   get_host  s
    	c         C   s   |  j  S(   N(   RV   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   get_selector%  s    c         C   sJ   |  j  d k r( |  j r( |  j |  _ n | |  _  |  j |  _ | |  _ d  S(   Nt   https(   RJ   RL   RE   RH   RV   (   R-   RE   RJ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt	   set_proxy(  s
    	c         C   s   |  j  |  j k S(   N(   RV   RH   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt	   has_proxy1  s    c         C   s   |  j  S(   N(   RQ   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   get_origin_req_host4  s    c         C   s   |  j  S(   N(   RR   (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   is_unverifiable7  s    c         C   s   | |  j  | j ƒ  <d  S(   N(   RM   t
   capitalize(   R-   RS   t   val(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRO   :  s    c         C   s   | |  j  | j ƒ  <d  S(   N(   RP   Rk   (   R-   RS   Rl   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   add_unredirected_header>  s    c         C   s   | |  j  k p | |  j k S(   N(   RM   RP   (   R-   t   header_name(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt
   has_headerB  s    c         C   s"   |  j  j | |  j j | | ƒ ƒ S(   N(   RM   t   getRP   (   R-   Rn   t   default(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR@   F  s    	c         C   s)   |  j  j ƒ  } | j |  j ƒ | j ƒ  S(   N(   RP   t   copyt   updateRM   RN   (   R-   R5   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   header_itemsK  s    N(   R0   R1   R   t   FalseR.   R\   R`   Ra   R_   Rb   R>   Rc   Rd   Re   Rg   Rh   Ri   Rj   RO   Rm   Ro   R@   Rt   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRG   à   s(   	
																t   OpenerDirectorc           B   sS   e  Z d  „  Z d „  Z d „  Z d „  Z d e j d „ Z	 d d „ Z
 d „  Z RS(   c         C   sM   d t  } d | f g |  _ g  |  _ i  |  _ i  |  _ i  |  _ i  |  _ d  S(   Ns   Python-urllib/%ss
   User-agent(   t   __version__t
   addheaderst   handlerst   handle_opent   handle_errort   process_responset   process_request(   R-   t   client_version(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   Q  s    
				c         C   sÃ  t  | d ƒ s( t d t | ƒ ƒ ‚ n  t } xet | ƒ D]W} | d k rS q; n  | j d ƒ } | |  } | | d } | j d ƒ r÷ | j d ƒ | d } | | d } y t | ƒ } Wn t k
 rÑ n X|  j	 j
 | i  ƒ }	 |	 |  j	 | <n] | d	 k r| } |  j }	 n? | d
 k r3| } |  j }	 n! | d k r; | } |  j }	 n q; |	 j | g  ƒ }
 |
 rt j |
 | ƒ n |
 j | ƒ t } q; W| r¿t j |  j | ƒ | j |  ƒ n  d  S(   Nt
   add_parents%   expected BaseHandler instance, got %rt   redirect_requestt   do_opent
   proxy_opent   _i   t   errorR!   t   responseRD   (   R€   R�   R‚   (   t   hasattrt	   TypeErrorRJ   Ru   t   dirt   findt
   startswitht   intR   R{   Rp   Rz   R|   R}   t
   setdefaultt   bisectt   insortt   appendt   TrueRy   R   (   R-   t   handlert   addedt   metht   it   protocolt	   conditiont   jt   kindt   lookupRy   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   add_handler\  sJ    

c         C   s   d  S(   N(    (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   close‹  s    c   	      G   sR   | j  | d ƒ } x9 | D]1 } t | | ƒ } | | Œ  } | d  k	 r | Sq Wd  S(   N(    (   Rp   RX   R   (	   R-   t   chainR˜   t	   meth_nameR+   Ry   R‘   t   funct   result(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   _call_chain�  s    c   
      C   sû   t  | t ƒ r! t | | ƒ } n" | } | d  k	 rC | j | ƒ n  | | _ | j ƒ  } | d } x8 |  j j | g  ƒ D]! } t	 | | ƒ } | | ƒ } qx W|  j
 | | ƒ }	 | d } x; |  j j | g  ƒ D]$ } t	 | | ƒ } | | |	 ƒ }	 qÏ W|	 S(   Nt   _requestt	   _response(   t
   isinstancet
   basestringRG   R   Ra   R$   Rc   R}   Rp   RX   t   _openR|   (
   R-   t   fullurlR#   R$   t   reqR•   R�   t	   processorR“   R…   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR!   ›  s"    	

c         C   ss   |  j  |  j d d | ƒ } | r% | S| j ƒ  } |  j  |  j | | d | ƒ } | rZ | S|  j  |  j d d | ƒ S(   NRq   t   default_openR¥   t   unknownt   unknown_open(   R    Rz   Rc   (   R-   R§   R#   RŸ   R•   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR¥   ·  s    c         G   s«   | d
 k r< |  j  d } | d } d | } d } | } n |  j  } | d } d } | | | f | } |  j | Œ  } | r� | S| r§ | d d	 f | } |  j | Œ  Sd  S(   Nt   httpRf   i   s   http_error_%si   t   _errori    Rq   t   http_error_default(   R¬   Rf   (   R{   R    (   R-   t   protoR+   t   dictR�   t   http_errt	   orig_argsRŸ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR„   Æ  s     

		
N(   R0   R1   R.   Rš   R›   R    R   t   sockett   _GLOBAL_DEFAULT_TIMEOUTR!   R¥   R„   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRv   P  s   		/		c             sR  d d l  ‰  ‡  f d †  } t ƒ  } t t t t t t t t	 g } t
 t d ƒ ra | j t ƒ n  t ƒ  } xl | D]d } x[ |  D]S } | | ƒ r² t | | ƒ rÑ | j | ƒ qÑ q~ t | | ƒ r~ | j | ƒ q~ q~ Wqq Wx | D] } | j | ƒ qà Wx | D] } | j | ƒ  ƒ qþ Wx3 |  D]+ } | | ƒ r=| ƒ  } n  | j | ƒ qW| S(   s+  Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable, HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    iÿÿÿÿNc            s   t  |  ˆ  j t f ƒ S(   N(   R£   t	   ClassTypeRJ   (   t   obj(   t   types(    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   isclassé  s    t   HTTPS(   R·   Rv   t   ProxyHandlert   UnknownHandlert   HTTPHandlert   HTTPDefaultErrorHandlert   HTTPRedirectHandlert
   FTPHandlert   FileHandlert   HTTPErrorProcessorR†   t   httplibR�   R   t   sett
   issubclasst   addR£   t   removeRš   (   Ry   R¸   R'   t   default_classest   skipt   klasst   checkt   h(    (   R·   s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR   ß  s2    				t   BaseHandlerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   iô  c         C   s   | |  _  d  S(   N(   t   parent(   R-   RÍ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR   	  s    c         C   s   d  S(   N(    (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR›     s    c         C   s#   t  | d ƒ s t S|  j | j k  S(   Nt   handler_order(   R†   R�   RÎ   (   R-   t   other(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   __lt__  s    (   R0   R1   RÎ   R   R›   RÐ   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÌ     s   		RÁ   c           B   s#   e  Z d  Z d Z d „  Z e Z RS(   s   Process HTTP error responses.iè  c         C   sd   | j  | j | j ƒ  } } } d | k o7 d k  n s` |  j j d | | | | | ƒ } n  | S(   NiÈ   i,  R¬   (   R3   R4   R9   RÍ   R„   (   R-   RD   R…   R3   R4   R5   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   http_response  s
     	(   R0   R1   R:   RÎ   RÑ   t   https_response(    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÁ     s   	R½   c           B   s   e  Z d  „  Z RS(   c         C   s"   t  | j ƒ  | | | | ƒ ‚ d  S(   N(   R2   R>   (   R-   R§   R6   R3   R4   R5   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR®   +  s    (   R0   R1   R®   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR½   *  s   R¾   c           B   s:   e  Z d  Z d Z d „  Z d „  Z e Z Z Z d Z	 RS(   i   i
   c   	      C   s±   | j  ƒ  } | d k r$ | d k s< | d k r� | d k r� | j d d	 ƒ } t d
 „  | j j ƒ  Dƒ ƒ } t | d | d | j ƒ  d t ƒSt | j	 ƒ  | | | | ƒ ‚ d S(   s­  Return a Request or None in response to a redirect.

        This is called by the http_error_30x methods when a
        redirection response is received.  If a redirection should
        take place, return a new Request to allow http_error_30x to
        perform the redirect.  Otherwise, raise HTTPError if no-one
        else should try to handle this url.  Return None if you can't
        but another Handler might.
        i-  i.  i/  i3  R^   t   HEADR]   t    s   %20c         s   s3   |  ]) \ } } | j  ƒ  d k r | | f Vq d S(   s   content-lengths   content-typeN(   s   content-lengths   content-type(   RC   (   t   .0t   kt   v(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pys	   <genexpr>J  s    	RM   RQ   RR   N(   i-  i.  i/  i3  (   R^   RÓ   (   i-  i.  i/  (
   R`   t   replaceR°   RM   RN   RG   Ri   R�   R2   R>   (	   R-   R§   R6   R3   R4   RM   t   newurlt   mt
   newheaders(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR€   6  s    
	c         C   s	  d | k r" | j  d ƒ d } n& d | k rD | j  d ƒ d } n d  St j | ƒ } | j rƒ | j rƒ t | ƒ } d | d <n  t j | ƒ } t j | j ƒ  | ƒ } | j ƒ  } | j	 d ƒ pà | j	 d ƒ pà | j	 d ƒ st
 | | | d	 | | | ƒ ‚ n  |  j | | | | | | ƒ }	 |	 d  k r4d  St | d
 ƒ r®| j }
 |	 _ |
 j | d ƒ |  j k sƒt |
 ƒ |  j k rÂt
 | j ƒ  | |  j | | | ƒ ‚ qÂn i  }
 |	 _ | _ |
 j | d ƒ d |
 | <| j ƒ  | j ƒ  |  j j |	 d | j ƒS(   Nt   locationi    t   urit   /i   s   http://s   https://s   ftp://s)    - Redirection to url '%s' is not allowedt   redirect_dicti   R$   (   t
   getheadersR?   t   patht   netloct   listt
   urlunparset   urljoinR>   RC   RŠ   R2   R€   R   R†   Rß   Rp   t   max_repeatst   lent   max_redirectionst   inf_msgt   readR›   RÍ   R!   R$   (   R-   R§   R6   R3   R4   RM   RÙ   t   urlpartst   newurl_lowert   newt   visited(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   http_error_302X  sB    	

so   The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
(
   R0   R1   Ræ   Rè   R€   Rï   t   http_error_301t   http_error_303t   http_error_307Ré   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR¾   .  s   	"	8c   	      C   sÓ   t  |  ƒ \ } } | j d ƒ s0 d } |  } nV | j d ƒ sR t d |  ƒ ‚ n  | j d d ƒ } | d k ry d } n  | d | !} t | ƒ \ } } | d k	 r¹ t | ƒ \ } } n
 d } } | | | | f S(   s3  Return (scheme, user, password, host/port) given a URL or an authority.

    If a URL is supplied, it must have an authority (host:port) component.
    According to RFC 3986, having an authority component means the URL must
    have two slashes after the scheme:

    >>> _parse_proxy('file:/ftp.example.com/')
    Traceback (most recent call last):
    ValueError: proxy URL with no authority: 'file:/ftp.example.com/'

    The first three items of the returned tuple may be None.

    Examples of authority parsing:

    >>> _parse_proxy('proxy.example.com')
    (None, None, None, 'proxy.example.com')
    >>> _parse_proxy('proxy.example.com:3128')
    (None, None, None, 'proxy.example.com:3128')

    The authority component may optionally include userinfo (assumed to be
    username:password):

    >>> _parse_proxy('joe:password@proxy.example.com')
    (None, 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('joe:password@proxy.example.com:3128')
    (None, 'joe', 'password', 'proxy.example.com:3128')

    Same examples, but with URLs instead:

    >>> _parse_proxy('http://proxy.example.com/')
    ('http', None, None, 'proxy.example.com')
    >>> _parse_proxy('http://proxy.example.com:3128/')
    ('http', None, None, 'proxy.example.com:3128')
    >>> _parse_proxy('http://joe:password@proxy.example.com/')
    ('http', 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
    ('http', 'joe', 'password', 'proxy.example.com:3128')

    Everything after the authority is ignored:

    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
    ('ftp', 'joe', 'password', 'proxy.example.com')

    Test for no trailing '/' case:

    >>> _parse_proxy('http://joe:password@proxy.example.com')
    ('http', 'joe', 'password', 'proxy.example.com')

    RÞ   s   //s   proxy URL with no authority: %ri   iÿÿÿÿN(   R   RŠ   R   R   R‰   R   R   (	   t   proxyt   schemet   r_schemet	   authorityt   endt   userinfot   hostportt   usert   password(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   _parse_proxy—  s    2		
Rº   c           B   s#   e  Z d  Z d d „ Z d „  Z RS(   id   c         C   s€   | d  k r t ƒ  } n  t | d ƒ s3 t d ƒ ‚ | |  _ x= | j ƒ  D]/ \ } } t |  d | | | |  j d „ ƒ qI Wd  S(   Nt   has_keys   proxies must be a mappings   %s_openc         S   s   | |  | | ƒ S(   N(    (   t   rRó   RJ   R“   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   <lambda>ê  s    (   R   R   R†   t   AssertionErrort   proxiesRN   t   setattrR‚   (   R-   R  RJ   R"   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   ã  s    	c         C   s  | j  ƒ  } t | ƒ \ } } } } | d  k r9 | } n  | j ƒ  | j r_ t | j ƒ r_ d  S| r³ | r³ d t | ƒ t | ƒ f }	 t j |	 ƒ j	 ƒ  }
 | j
 d d |
 ƒ n  t | ƒ } | j | | ƒ | | k sç | d k rë d  S|  j j | d | j ƒSd  S(   Ns   %s:%ss   Proxy-authorizations   Basic Rf   R$   (   Rc   Rü   R   Rd   RE   R   R   t   base64t	   b64encodet   stripRO   Rg   RÍ   R!   R$   (   R-   R§   Ró   RJ   t	   orig_typet
   proxy_typeRú   Rû   Rù   t	   user_passt   creds(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR‚   í  s     	
N(   R0   R1   RÎ   R   R.   R‚   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRº   ß  s   
t   HTTPPasswordMgrc           B   s8   e  Z d  „  Z d „  Z d „  Z e d „ Z d „  Z RS(   c         C   s   i  |  _  d  S(   N(   t   passwd(   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.     s    c         C   s—   t  | t ƒ r | g } n  | |  j k r: i  |  j | <n  xV t t f D]H } t g  | D] } |  j | | ƒ ^ qW ƒ } | | f |  j | | <qG Wd  S(   N(   R£   R¤   R  R�   Ru   t   tuplet
   reduce_uri(   R-   t   realmRÝ   Rú   R  t   default_portt   ut   reduced_uri(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   add_password  s    (c   	      C   s†   |  j  j | i  ƒ } xj t t f D]\ } |  j | | ƒ } xA | j ƒ  D]3 \ } } x$ | D] } |  j | | ƒ rZ | SqZ WqG Wq" Wd S(   N(   NN(   R  Rp   R�   Ru   R  t	   iteritemst	   is_suburiR   (	   R-   R  t   authurit   domainsR  t   reduced_authurit   urist   authinfoRÝ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   find_user_password  s    c   
      C   sË   t  j | ƒ } | d r@ | d } | d } | d p: d } n d
 } | } d } t | ƒ \ } } | rÁ | d
 k rÁ | d
 k	 rÁ i d d 6d d 6j | ƒ }	 |	 d
 k	 rÁ d	 | |	 f } qÁ n  | | f S(   s@   Accept authority or URI and extract only the authority and path.i   i    i   RÞ   iP   R¬   i»  Rf   s   %s:%dN(   R?   t   urlsplitR   R   Rp   (
   R-   RÝ   R  t   partsRô   Rö   Rá   RE   RK   t   dport(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR  &  s     




	c         C   si   | | k r t  S| d | d k r( t St j | d | d f ƒ } t | ƒ t | d ƒ k re t  St S(   sc   Check if test is below base in a URI tree

        Both args must be URIs in reduced form.
        i    i   (   R�   Ru   t	   posixpatht   commonprefixRç   (   R-   t   baset   testt   common(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR  =  s    (   R0   R1   R.   R  R  R�   R  R  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR
    s
   			
t   HTTPPasswordMgrWithDefaultRealmc           B   s   e  Z d  „  Z RS(   c         C   sD   t  j |  | | ƒ \ } } | d  k	 r1 | | f St  j |  d  | ƒ S(   N(   R
  R  R   (   R-   R  R  Rú   Rû   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR  N  s
    
(   R0   R1   R  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR#  L  s   t   AbstractBasicAuthHandlerc           B   s;   e  Z e j d  e j ƒ Z d d „ Z d „  Z d „  Z	 RS(   s1   (?:.*,)*[ 	]*([^ 	]+)[ 	]+realm=(["']?)([^"']*)\2c         C   s4   | d  k r t ƒ  } n  | |  _ |  j j |  _ d  S(   N(   R   R
  R  R  (   R-   t   password_mgr(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   d  s    	c   	      C   s–   | j  | d  ƒ } | r’ t j j | ƒ } | r’ | j ƒ  \ } } } | d k rg t j d t d ƒ n  | j	 ƒ  d k r� |  j
 | | | ƒ Sq’ n  d  S(   Nt   "t   's   Basic Auth Realm was unquotedi   t   basic(   R&  R'  (   Rp   R   R$  t   rxt   searcht   groupst   warningst   warnt   UserWarningRC   t   retry_http_basic_auth(	   R-   t   authreqRE   R§   RM   t   moRô   R   R  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   http_error_auth_reqedk  s    	c         C   s£   |  j  j | | ƒ \ } } | d  k	 r› d | | f } d t j | ƒ j ƒ  } | j |  j d  ƒ | k ro d  S| j |  j | ƒ |  j	 j
 | d | j ƒSd  Sd  S(   Ns   %s:%ss   Basic %sR$   (   R  R  R   R  R  R  R@   t   auth_headerRm   RÍ   R!   R$   (   R-   RE   R§   R  Rú   t   pwt   rawt   auth(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR/  {  s    N(
   R0   R1   t   ret   compilet   IR)  R   R.   R2  R/  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR$  V  s
   		t   HTTPBasicAuthHandlerc           B   s   e  Z d  Z d „  Z RS(   t   Authorizationc         C   s(   | j  ƒ  } |  j d | | | ƒ } | S(   Ns   www-authenticate(   R>   R2  (   R-   R§   R6   R3   R4   RM   R"   R…   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   http_error_401Œ  s    	(   R0   R1   R3  R<  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR:  ˆ  s   t   ProxyBasicAuthHandlerc           B   s   e  Z d  Z d „  Z RS(   s   Proxy-authorizationc         C   s(   | j  ƒ  } |  j d | | | ƒ } | S(   Ns   proxy-authenticate(   Rd   R2  (   R-   R§   R6   R3   R4   RM   Rö   R…   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   http_error_407—  s    	(   R0   R1   R3  R>  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR=  “  s   c         C   s}   t  j j d ƒ r; t d ƒ } | j |  ƒ } | j ƒ  | Sg  t |  ƒ D] } t t j	 d d ƒ ƒ ^ qH } d j
 | ƒ Sd S(   s   Return n random bytes.s   /dev/urandomi    i   R<   N(   t   osRá   t   existsR!   Rê   R›   t   ranget   chrt   randomt	   randranget   join(   t   nt   ft   sR”   t   L(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   randombytes¢  s    
1t   AbstractDigestAuthHandlerc           B   sS   e  Z d d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   sO   | d  k r t ƒ  } n  | |  _ |  j j |  _ d |  _ d |  _ d  |  _ d  S(   Ni    (   R   R
  R  R  t   retriedt   nonce_countt
   last_nonce(   R-   R  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   »  s    			c         C   s   d |  _  d  S(   Ni    (   RL  (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   reset_retry_countÄ  s    c         C   s�   | j  | d  ƒ } |  j d k rB t | j ƒ  d d | d  ƒ ‚ n |  j d 7_ | rŒ | j ƒ  d } | j ƒ  d k rŒ |  j | | ƒ Sn  d  S(   Ni   i‘  s   digest auth failedi   i    t   digest(   Rp   R   RL  R2   R>   t   splitRC   t   retry_http_digest_auth(   R-   R3  RE   R§   RM   R0  Rô   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR2  Ç  s    c         C   s¤   | j  d d ƒ \ } } t t | ƒ ƒ } |  j | | ƒ } | r  d | } | j j |  j d  ƒ | k rn d  S| j |  j | ƒ |  j	 j
 | d | j ƒ} | Sd  S(   NRÔ   i   s	   Digest %sR$   (   RQ  t   parse_keqv_listt   parse_http_listt   get_authorizationRM   Rp   R3  R   Rm   RÍ   R!   R$   (   R-   R§   R6  t   tokent	   challenget   chalt   auth_valt   resp(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRR  Ø  s    
c         C   s<   t  j d |  j | t j ƒ  t d ƒ f ƒ j ƒ  } | d  S(   Ns   %s:%s:%s:%si   i   (   t   hashlibt   sha1RM  t   timet   ctimeRJ  t	   hexdigest(   R-   t   noncet   dig(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt
   get_cnonceä  s    c         C   sd  yK | d } | d } | j  d ƒ } | j  d d ƒ } | j  d d  ƒ } Wn t k
 r_ d  SX|  j | ƒ \ } }	 | d  k r… d  S|  j j | | j ƒ  ƒ \ }
 } |
 d  k r¶ d  S| j ƒ  rÝ |  j | j	 ƒ  | ƒ } n d  } d |
 | | f } d | j
 ƒ  | j ƒ  f } | d	 k r¤| |  j k r?|  j d
 7_ n d
 |  _ | |  _ d |  j } |  j | ƒ } d | | | | | | ƒ f } |	 | | ƒ | ƒ } nD | d  k rØ|	 | | ƒ d | | | ƒ f ƒ } n t d | ƒ ‚ d |
 | | | j ƒ  | f } | r| d | 7} n  | r5| d | 7} n  | d | 7} | r`| d | | f 7} n  | S(   NR  R`  t   qopt	   algorithmt   MD5t   opaques   %s:%s:%ss   %s:%sR6  i   s   %08xs   %s:%s:%s:%s:%ss   qop '%s' is not supported.s>   username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s   , opaque="%s"s   , digest="%s"s   , algorithm="%s"s   , qop=auth, nc=%s, cnonce="%s"(   Rp   R   t   KeyErrort   get_algorithm_implsR  R  R>   R_   t   get_entity_digestRb   R`   Re   RN  RM  Rb  R*   (   R-   R§   RX  R  R`  Rc  Rd  Rf  t   Ht   KDRú   R4  t   entdigt   A1t   A2t   ncvaluet   cnoncet   noncebitt   respdigR   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRU  î  sV    

!		(
c            sk   | j  ƒ  } | d k r$ d „  ‰  n. | d k r< d „  ‰  n t d | j ƒ  ƒ ‚ ‡  f d †  } ˆ  | f S(   NRe  c         S   s   t  j |  ƒ j ƒ  S(   N(   R[  t   md5R_  (   t   x(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÿ   0  R<   t   SHAc         S   s   t  j |  ƒ j ƒ  S(   N(   R[  R\  R_  (   Rt  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÿ   2  R<   s.   Unsupported digest authentication algorithm %rc            s   ˆ  d |  | f ƒ S(   Ns   %s:%s(    (   RH  t   d(   Rj  (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÿ   7  R<   (   t   upperR   RC   (   R-   Rd  Rk  (    (   Rj  s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRh  +  s    c         C   s   d  S(   N(   R   (   R-   R#   RX  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRi  :  s    N(   R0   R1   R   R.   RO  R2  RR  Rb  RU  Rh  Ri  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRK  °  s   					
	=	t   HTTPDigestAuthHandlerc           B   s#   e  Z d  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.
    R;  iê  c         C   s?   t  j  | j ƒ  ƒ d } |  j d | | | ƒ } |  j ƒ  | S(   Ni   s   www-authenticate(   R?   R>   R2  RO  (   R-   R§   R6   R3   R4   RM   RE   t   retry(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR<  I  s
    	
(   R0   R1   R:   R3  RÎ   R<  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRx  ?  s   t   ProxyDigestAuthHandlerc           B   s   e  Z d  Z d Z d „  Z RS(   s   Proxy-Authorizationiê  c         C   s2   | j  ƒ  } |  j d | | | ƒ } |  j ƒ  | S(   Ns   proxy-authenticate(   Rd   R2  RO  (   R-   R§   R6   R3   R4   RM   RE   Ry  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR>  V  s
    	
(   R0   R1   R3  RÎ   R>  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRz  Q  s   t   AbstractHTTPHandlerc           B   s/   e  Z d  d „ Z d „  Z d „  Z d „  Z RS(   i    c         C   s   | |  _  d  S(   N(   t   _debuglevel(   R-   t
   debuglevel(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   _  s    c         C   s   | |  _  d  S(   N(   R|  (   R-   t   level(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   set_http_debuglevelb  s    c   
      C   s:  | j  ƒ  } | s! t d ƒ ‚ n  | j ƒ  rŠ | j ƒ  } | j d ƒ s[ | j d d ƒ n  | j d ƒ sŠ | j d d t | ƒ ƒ qŠ n  | } | j ƒ  rÉ t | j	 ƒ  ƒ \ } } t
 | ƒ \ } } n  | j d ƒ së | j d | ƒ n  xH |  j j D]: \ } }	 | j ƒ  } | j | ƒ sø | j | |	 ƒ qø qø W| S(   Ns   no host givens   Content-types!   application/x-www-form-urlencodeds   Content-lengths   %dR=   (   Rd   R*   R_   Rb   Ro   Rm   Rç   Rh   R   Re   R   RÍ   Rx   Rk   (
   R-   RD   RE   R#   t   sel_hostRô   t   selt   sel_patht   nameRT   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   do_request_e  s.    
c            sâ  | j  ƒ  } | s! t d ƒ ‚ n  | | d | j | �} | j |  j ƒ t | j ƒ ‰  ˆ  j t ‡  f d †  | j j	 ƒ  Dƒ ƒ ƒ d ˆ  d <t d „  ˆ  j	 ƒ  Dƒ ƒ ‰  | j
 rü i  } d } | ˆ  k rã ˆ  | | | <ˆ  | =n  | j | j
 d | ƒn  y) | j | j ƒ  | j ƒ  | j ˆ  ƒ Wn, t j k
 rS} | j ƒ  t | ƒ ‚ n7 Xy | j d	 t ƒ }	 Wn t k
 r‰| j ƒ  }	 n X|	 j |	 _ t j |	 d t ƒ}
 t |
 |	 j | j ƒ  ƒ } |	 j | _ |	 j | _ | S(
   s¦  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
        s   no host givenR$   c         3   s-   |  ]# \ } } | ˆ  k r | | f Vq d  S(   N(    (   RÕ   RÖ   R×   (   RM   (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pys	   <genexpr>•  s    	R›   t
   Connectionc         s   s'   |  ] \ } } | j  ƒ  | f Vq d  S(   N(   t   title(   RÕ   Rƒ  Rl   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pys	   <genexpr>   s    s   Proxy-AuthorizationRM   t	   buffering(   Rd   R*   R$   t   set_debuglevelR|  R°   RP   Rs   RM   RN   RL   t
   set_tunnelRD   R`   Re   R#   R³   R„   R›   t   getresponseR�   R‡   Rê   t   recvt   _fileobjectR   R4   R>   t   statusR3   R,   (   R-   t
   http_classR§   t   http_conn_argsRE   RË   t   tunnel_headerst   proxy_auth_hdrt   errRþ   R6   RZ  (    (   RM   s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR�   ‚  s@    
,	
	
)
(   R0   R1   R.   R  R„  R�   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR{  ]  s   		R¼   c           B   s   e  Z d  „  Z e j Z RS(   c         C   s   |  j  t j | ƒ S(   N(   R�   RÂ   t   HTTPConnection(   R-   R§   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt	   http_openÍ  s    (   R0   R1   R”  R{  R„  t   http_request(    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR¼   Ë  s   	R¹   R   c           B   s)   e  Z d  d d „ Z d „  Z e j Z RS(   i    c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R{  R.   t   _context(   R-   R}  R   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   Õ  s    c         C   s   |  j  t j | d |  j ƒS(   NR   (   R�   RÂ   t   HTTPSConnectionR–  (   R-   R§   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt
   https_openÙ  s    N(   R0   R1   R   R.   R˜  R{  R„  t   https_request(    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR   Ó  s   	t   HTTPCookieProcessorc           B   s2   e  Z d d  „ Z d „  Z d „  Z e Z e Z RS(   c         C   s4   d d  l  } | d  k r' | j ƒ  } n  | |  _ d  S(   Niÿÿÿÿ(   t	   cookielibR   t	   CookieJart	   cookiejar(   R-   R�  R›  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   à  s    c         C   s   |  j  j | ƒ | S(   N(   R�  t   add_cookie_header(   R-   RD   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR•  æ  s    c         C   s   |  j  j | | ƒ | S(   N(   R�  t   extract_cookies(   R-   RD   R…   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÑ   ê  s    N(   R0   R1   R   R.   R•  RÑ   R™  RÒ   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRš  ß  s
   		R»   c           B   s   e  Z d  „  Z RS(   c         C   s    | j  ƒ  } t d | ƒ ‚ d  S(   Ns   unknown url type: %s(   Rc   R*   (   R-   R§   RJ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR«   ò  s    (   R0   R1   R«   (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR»   ñ  s   c         C   sm   i  } x` |  D]X } | j  d d ƒ \ } } | d d k r[ | d d k r[ | d d !} n  | | | <q W| S(   s>   Parse list of key=value strings where keys are not duplicated.t   =i   i    R&  iÿÿÿÿ(   RQ  (   t   lt   parsedt   eltRÖ   R×   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRS  ö  s     c         C   sý   g  } d } t  } } x± |  D]© } | r? | | 7} t  } q n  | r‚ | d k r] t } q n | d k rr t  } n  | | 7} q n  | d k r§ | j | ƒ d } q n  | d k r¼ t } n  | | 7} q W| rà | j | ƒ n  g  | D] } | j ƒ  ^ qç S(   sp  Parse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Neither commas nor quotes count if they are escaped.
    Only double-quotes count, not single-quotes.
    R<   s   \R&  t   ,(   Ru   R�   R�   R  (   RH  t   rest   partt   escapeR   t   cur(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRT     s4    	

	
	c         C   s-   y t  j |  ƒ SWn t  j k
 r( d  SXd  S(   N(   R³   t   gethostbynamet   gaierrorR   (   RE   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   _safe_gethostbyname+  s    RÀ   c           B   s)   e  Z d  „  Z d Z d „  Z d „  Z RS(   c         C   sq   | j  ƒ  } | d  d k r` | d d !d k r` | j r` | j d k r` d | _ |  j j | ƒ S|  j | ƒ Sd  S(   Ni   s   //i   RÞ   R   t   ftp(   Re   RE   RJ   RÍ   R!   t   open_local_file(   R-   R§   R"   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt	   file_open3  s    ,	c         C   s|   t  j d  k ru y7 t t j d ƒ d t j t j ƒ  ƒ d ƒ t  _ Wqu t j k
 rq t j d ƒ f t  _ qu Xn  t  j S(   NR   i   (	   RÀ   t   namesR   R  R³   t   gethostbyname_ext   gethostnameRª  R©  (   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt	   get_names>  s    $c         C   s[  d d  l  } d d  l } | j ƒ  } | j ƒ  } t | ƒ } yí t j | ƒ } | j } | j j	 | j
 d t ƒ}	 | j | ƒ d }
 t j t d |
 pš d | |	 f ƒ ƒ } | rÈ t | ƒ \ } } n  | sî | r(t | ƒ |  j ƒ  k r(| rd | | } n
 d | } t t | d ƒ | | ƒ SWn t k
 rJ} t | ƒ ‚ n Xt d ƒ ‚ d  S(	   Niÿÿÿÿt   usegmti    s6   Content-type: %s
Content-length: %d
Last-modified: %s
s
   text/plains   file://t   rbs   file not on local host(   t   email.utilst	   mimetypesRd   Re   R   R?  t   statt   st_sizet   utilst
   formatdatet   st_mtimeR�   t
   guess_typet	   mimetoolst   MessageR    R   R«  R²  R   R!   t   OSErrorR*   (   R-   R§   t   emailR¶  RE   R7   t	   localfilet   statst   sizet   modifiedt   mtypeRM   RK   t   origurlR4   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR­  I  s0    		
N(   R0   R1   R®  R   R¯  R²  R­  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÀ   1  s   	
	R¿   c           B   s   e  Z d  „  Z d „  Z RS(   c         C   sÍ  d d  l  } d d  l } | j ƒ  } | s9 t d ƒ ‚ n  t | ƒ \ } } | d  k rc | j } n t | ƒ } t | ƒ \ } } | rœ t	 | ƒ \ } } n d  } t
 | ƒ } | p· d } | pÃ d } y t j | ƒ } Wn" t j k
 rý } t | ƒ ‚ n Xt | j ƒ  ƒ \ }	 }
 |	 j d ƒ } t t
 | ƒ } | d  | d } } | rg| d rg| d } n  y/|  j | | | | | | j ƒ } | r—d pšd } xM |
 D]E } t | ƒ \ } } | j ƒ  d	 k r¤| d k r¤| j ƒ  } q¤q¤W| j | | ƒ \ } } d } | j | j ƒ  ƒ d } | r;| d | 7} n  | d  k	 rd| d k rd| d | 7} n  t | ƒ } t j | ƒ } t | | | j ƒ  ƒ SWn0 | j k
 rÈ} t d | t j  ƒ  d ‚ n Xd  S(   Niÿÿÿÿs   ftp error: no host givenR<   RÞ   i    i   R9  t   DRJ   t   at   AR”   Rv  s   Content-type: %s
s   Content-length: %d
s   ftp error: %si   (   RÈ  RÉ  R”   R9  Rv  RÇ  (!   t   ftplibR¶  Rd   R*   R   R   t   FTP_PORTR‹   R   R   R   R³   R©  R„   R
   Re   RQ  t   mapt   connect_ftpR$   R   RC   Rw  t   retrfileR¼  R>   R    R½  R¾  R   t
   all_errorst   syst   exc_info(   R-   R§   RÊ  R¶  RE   RK   Rú   R  R4   Rá   t   attrst   dirst   filet   fwRJ   R[   RT   R6   t   retrlenRM   RÅ  t   sf(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   ftp_openf  s\    !c      	   C   s%   t  | | | | | | d t ƒ} | S(   Nt
   persistent(   R   Ru   (   R-   Rú   R  RE   RK   RÓ  R$   RÕ  (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÍ  ›  s    	(   R0   R1   RØ  RÍ  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR¿   e  s   	5t   CacheFTPHandlerc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s1   i  |  _  i  |  _ d |  _ d |  _ d |  _ d  S(   Ni    i<   i   (   t   cacheR$   t   soonestt   delayt	   max_conns(   R-   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyR.   ¤  s
    				c         C   s   | |  _  d  S(   N(   RÝ  (   R-   t   t(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt
   setTimeout«  s    c         C   s   | |  _  d  S(   N(   RÞ  (   R-   RÚ   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   setMaxConns®  s    c         C   s›   | | | d j  | ƒ | f } | |  j k rJ t j ƒ  |  j |  j | <n< t | | | | | | ƒ |  j | <t j ƒ  |  j |  j | <|  j ƒ  |  j | S(   NRÞ   (   RE  RÛ  R]  RÝ  R$   R   t   check_cache(   R-   Rú   R  RE   RK   RÓ  R$   RS   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÍ  ±  s    "
c         C   s  t  j  ƒ  } |  j | k rr xT |  j j ƒ  D]@ \ } } | | k  r+ |  j | j ƒ  |  j | =|  j | =q+ q+ Wn  t |  j j ƒ  ƒ |  _ t |  j ƒ |  j	 k rxD |  j j ƒ  D]3 \ } } | |  j k r² |  j | =|  j | =Pq² q² Wt |  j j ƒ  ƒ |  _ n  d  S(   N(
   R]  RÜ  R$   RN   RÛ  R›   t   mint   valuesRç   RÞ  (   R-   Rß  RÖ   R×   (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRâ  »  s    


c         C   sB   x! |  j  j ƒ  D] } | j ƒ  q W|  j  j ƒ  |  j j ƒ  d  S(   N(   RÛ  Rä  R›   t   clearR$   (   R-   t   conn(    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   clear_cacheÏ  s    (   R0   R1   R.   Rà  Rá  RÍ  Râ  Rç  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyRÚ  ¡  s   				
	(    (    (    (    (    (    (T   R:   R  R[  RÂ   R½  R?  R  RC  R7  R³   RÐ  R]  R?   R�   R,  t	   cStringIOR    t   ImportErrorR   Ru   R   R�   t   urllibR   R   R   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   t   versionRw   R   R    R´   R(   R)   t   IOErrorR*   R2   R8  RA   RF   RG   Rv   R   RÌ   RÁ   R½   R¾   Rü   Rº   R
  R#  R$  R:  R=  RJ  RK  Rx  Rz  R{  R¼   R†   R   Rš  R»   RS  RT  R«  RÀ   R¿   RÚ  (    (    (    s,   /opt/alt/python27/lib64/python2.7/urllib2.pyt   <module>L   s€   
^"			p�	'i	H-@
2	�n	
	+	4<