ó
4Mc        
   @   sã  d  d l  m Z d Z d Z d d d d d d	 d
 g Z d Z 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 d  d l Z d  d l Z d  d l Z y d  d l m Z m Z Wn; e k
 rfd  d l Z d  d l Z e j Z e j Z n Xd  d l  Z  d  d l! m! Z" d  d l# Z# y d  d l$ Z$ Wn e k
 r¸e% Z$ n Xy d  d l& Z& e& j' Z( Wn e k
 rîd „  Z( n Xe j) d d f k rd  d l* m* Z* n	 d „  Z* d „  Z+ d d d d d d d d d d g
 Z, d  Z- e j) d d! f k  rtd" „  Z. n  d# „  Z/ e0 e j1 d$ ƒ rŸe/ e j1 _2 n  d e3 f d% „  ƒ  YZ4 d& e4 f d' „  ƒ  YZ5 d e5 f d( „  ƒ  YZ6 d e5 f d) „  ƒ  YZ7 d e5 f d* „  ƒ  YZ8 d e5 f d+ „  ƒ  YZ9 d e5 f d, „  ƒ  YZ: d- e4 f d. „  ƒ  YZ; d/ e4 f d0 „  ƒ  YZ< d1 Z= d2 d3 d4 d5 d6 d7 d8 d9 g Z> d: „  Z? e j@ d; ƒ ZA d< „  ZB d= „  ZC e j@ d> ƒ ZD e j@ d? ƒ ZE d@ „  ZF e j@ dA ƒ ZG dB „  ZH dC „  ZI d  ZJ e j@ dD ƒ ZK e j@ dE ƒ ZL e j@ dF ƒ ZM dG dH „ ZN dI „  ZO dJ „  ZP dK „  ZQ dL „  ZR dM „  ZS dN eT f dO „  ƒ  YZU dP eU f dQ „  ƒ  YZV dR eU f dS „  ƒ  YZW dT eU f dU „  ƒ  YZX dV eU f dW „  ƒ  YZY dX eU f dY „  ƒ  YZZ i eV dZ 6eY d[ 6eW d\ 6eX d] 6eZ d^ 6Z[ d] d^ d\ d[ dZ g Z\ d_ eT f d` „  ƒ  YZ] da eT f db „  ƒ  YZ^ dc e^ f dd „  ƒ  YZ_ d eT f de „  ƒ  YZ` df e ja f dg „  ƒ  YZb dh e jc f di „  ƒ  YZd d eT f dj „  ƒ  YZe d ef f dk „  ƒ  YZg d S(l   iÿÿÿÿ(   t
   generatorss!   Joe Gregorio (joe@bitworking.org)s   Copyright 2006, Joe Gregorios!   Thomas Broyer (t.broyer@ltgt.net)s   James Antills   Xavier Verges Farreros   Jonathan Feinbergs   Blair Zajacs   Sam Rubys   Louis Nyffeneggert   MITs   $Rev$N(   t   sha1t   md5(   t   gettextc         C   s%   t  j |  | | ƒ } t j |  | ƒ S(   N(   t   sockett   sslt   httplibt
   FakeSocket(   t   sockt   key_filet	   cert_filet   ssl_sock(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _ssl_wrap_socketB   s    i   i   (   t   iri2uric         C   s   |  S(   N(    (   t   uri(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   J   s    c         C   s2   t  t d ƒ r( |  d  k	 o' |  t j k	 S|  d  k	 S(   Nt   _GLOBAL_DEFAULT_TIMEOUT(   t   hasattrR   t   NoneR   (   t   timeout(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   has_timeoutM   s    t   Httpt   Responset	   ProxyInfot   HttpLib2Errort   RedirectMissingLocationt   RedirectLimitt   FailedToDecompressContentt"   UnimplementedDigestAuthOptionErrort&   UnimplementedHmacDigestAuthOptionErrort
   debugleveli    i   c         C   s   |  j  ƒ  |  S(   N(   t   sort(   t   seq(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   sorted^   s    
c         C   s+   |  j  d k r t j ƒ  ‚ n  |  j  j ƒ  S(   s&   Return list of (header, value) tuples.N(   t   msgR   R   t   ResponseNotReadyt   items(   t   self(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   HTTPResponse__getheadersc   s    t
   getheadersc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   m   s    t   HttpLib2ErrorWithResponsec           B   s   e  Z d  „  Z RS(   c         C   s&   | |  _  | |  _ t j |  | ƒ d  S(   N(   t   responset   contentR   t   __init__(   R%   t   descR+   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   r   s    		(   R(   R)   R-   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR*   q   s   c           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   w   s    c           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   x   s    c           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   y   s    c           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   z   s    c           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   {   s    t   RelativeURIErrorc           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR/   }   s    t   ServerNotFoundErrorc           B   s   e  Z RS(    (   R(   R)   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR0   ~   s    i   t
   connections
   keep-alives   proxy-authenticates   proxy-authorizationt   tet   trailerss   transfer-encodingt   upgradec         C   sp   t  t ƒ } | j g  |  j d d ƒ j d ƒ D] } | j ƒ  ^ q. ƒ g  |  j ƒ  D] } | | k rT | ^ qT S(   NR1   t    t   ,(   t   listt
   HOP_BY_HOPt   extendt   gett   splitt   stript   keys(   R+   t   hopbyhopt   xt   header(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _get_end2end_headers™   s    ;s9   ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?c         C   s<   t  j |  ƒ j ƒ  } | d | d | d | d | d f S(   s‡   Parses a URI using the regex given in Appendix B of RFC 3986.

        (scheme, authority, path, query, fragment) = parse_uri(uri)
    i   i   i   i   i   (   t   URIt   matcht   groups(   R   RD   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt	   parse_uri    s    c         C   s²   t  |  ƒ \ } } } } } | s) | r< t d |  ƒ ‚ n  | j ƒ  } | j ƒ  } | sc d } n  | r~ d j | | g ƒ p | } | j ƒ  } | d | | } | | | | f S(   Ns(   Only absolute URIs are allowed. uri = %st   /t   ?s   ://(   RE   R/   t   lowert   join(   R   t   schemet	   authorityt   patht   queryt   fragmentt   request_urit
   defrag_uri(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   urlnorm¨   s    	!s   ^\w+://s   [?/:|]+c         C   sò   yU t  j |  ƒ rT t |  t ƒ rB |  j d ƒ }  |  j d ƒ }  qT |  j d ƒ }  n  Wn t k
 rh n Xt |  t ƒ rŠ |  j d ƒ }  n  t |  ƒ j	 ƒ  } t  j
 d |  ƒ }  t j
 d |  ƒ }  t |  ƒ d k rß |  d  }  n  d j |  | f ƒ S(   s•   Return a filename suitable for the cache.

    Strips dangerous and common characters to create a filename we
    can use to store the cache in.
    s   utf-8t   idnaR5   R6   iÈ   (   t   re_url_schemeRC   t
   isinstancet   strt   decodet   encodet   UnicodeErrort   unicodet   _md5t	   hexdigestt   subt   re_slasht   lenRI   (   t   filenamet   filemd5(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   safename¼   s     s   (?:\r\n)?[ \t]+c         C   sG   t  g  |  j ƒ  D]0 \ } } | j ƒ  t j | d ƒ j ƒ  f ^ q ƒ S(   Nt    (   t   dictt	   iteritemsRH   t   NORMALIZE_SPACER\   R<   (   t   headerst   keyt   value(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _normalize_headersØ   s    c         C   sÞ   i  } |  j  d ƒ rÚ |  d j d ƒ } g  | D]R } d | j d ƒ k r/ t g  | j d d ƒ D] } | j ƒ  j ƒ  ^ q` ƒ ^ q/ } g  | D]3 } d | j d ƒ k rŽ | j ƒ  j ƒ  d f ^ qŽ } t | | ƒ } n  | S(   Ns   cache-controlR6   iÿÿÿÿt   =i   (   t   has_keyR;   t   findt   tupleR<   RH   Rc   (   Rf   t   retvalt   partst   partR?   t   parts_with_argst   namet   parts_wo_args(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _parse_cache_controlÛ   s    _@sÊ   ^(?:\s*(?:,\s*)?([^\0-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+)\s*=\s*\"?((?<=\")(?:[^\0-\x08\x0A-\x1f\x7f-\xff\\\"]|\\[\0-\x7f])*?(?=\")|(?<!\")[^\0-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+(?!\"))\"?)(.*)$sk   ^(?:\s*(?:,\s*)?([^ \t\r\n=]+)\s*=\s*\"?((?<=\")(?:[^\\\"]|\\.)*?(?=\")|(?<!\")[^ \t\r\n,]+(?!\"))\"?)(.*)$s   \\(.)s   www-authenticatec         C   s  i  } |  j  | ƒ r|  | j ƒ  } t r1 t p4 t } xà | r| d k r\ d | } } n | j d d ƒ \ } } | j | ƒ } i  } xk | rö | rä t | j ƒ  ƒ d k rä | j ƒ  \ }	 }
 } t	 j
 d |
 ƒ | |	 j ƒ  <n  | j | ƒ } qŒ W| | | j ƒ  <| j ƒ  } q: Wn  | S(   sC   Returns a dictionary of dictionaries, one dict
    per auth_scheme.s   authentication-infot   digestRb   i   i   s   \1(   Rk   R<   t   USE_WWW_AUTH_STRICT_PARSINGt   WWW_AUTH_STRICTt   WWW_AUTH_RELAXEDR;   t   searchR^   RD   t   UNQUOTE_PAIRSR\   RH   (   Rf   t
   headernameRn   t   authenticatet   www_autht   auth_schemet   the_restRC   t   auth_paramsRg   Rh   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _parse_www_authenticateò   s$    		c         C   sH  d } t  | ƒ } t  |  ƒ } | j d ƒ rn | d j ƒ  j d ƒ d k rn d } d | k rDd | d <qDnÖ| j d ƒ r† d } n¾| j d ƒ rž d } n¦| j d ƒ r¶ d } nŽ|  j d	 ƒ rDt j t j j |  d	 ƒ ƒ } t	 j	 ƒ  } t
 d
 | | ƒ } | j d ƒ rCy t | d ƒ } Wq¢t k
 r?d
 } q¢Xn_ |  j d ƒ rœt j j |  d ƒ }	 d |	 k r}d
 } q¢t
 d
 t j |	 ƒ | ƒ } n d
 } | j d ƒ rây t | d ƒ } Wqât k
 rÞd
 } qâXn  | j d ƒ r,y t | d ƒ }
 Wn t k
 rd
 }
 n X| |
 7} n  | | k rDd } qDn  | S(   sô  Determine freshness from the Date, Expires and Cache-Control headers.

    We don't handle the following:

    1. Cache-Control: max-stale
    2. Age: headers are not used in the calculations.

    Not that this algorithm is simpler than you might think 
    because we are operating as a private (non-shared) cache.
    This lets us ignore 's-maxage'. We can also ignore
    'proxy-invalidate' since we aren't a proxy.
    We will never return a stale document as 
    fresh as a design decision, and thus the non-implementation 
    of 'max-stale'. This also lets us safely ignore 'must-revalidate' 
    since we operate as if every server has sent 'must-revalidate'.
    Since we are private we get to ignore both 'public' and
    'private' parameters. We also ignore 'no-transform' since
    we don't do any transformations.    
    The 'no-store' parameter is handled at a higher level.
    So the only Cache-Control parameters we look at are:

    no-cache
    only-if-cached
    max-age
    min-fresh
    t   STALEt   pragmas   no-cacheiÿÿÿÿt   TRANSPARENTs   cache-controls   only-if-cachedt   FRESHt   datei    s   max-aget   expiress	   min-freshN(   Rt   Rk   RH   Rl   t   calendart   timegmt   emailt   Utilst   parsedate_tzt   timet   maxt   intt
   ValueErrorR   (   t   response_headerst   request_headersRn   t   cct   cc_responseR†   t   nowt   current_aget   freshness_lifetimeR‡   t	   min_fresh(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _entry_disposition  sT    .				
c         C   sò   | } yž |  j  d d  ƒ } | d	 k r£ | d k rW t j d t j | ƒ ƒ j ƒ  } n  | d k ru t j | ƒ } n  t t	 | ƒ ƒ |  d <|  d |  d <|  d =n  WnG t
 t j f k
 rí } d } t t d ƒ |  j  d ƒ |  | ƒ ‚ n X| S(
   Ns   content-encodingt   gzipt   deflatet   fileobjs   content-lengths   -content-encodingR5   sD   Content purported to be compressed with %s but failed to decompress.(   s   gzips   deflate(   R:   R   Rš   t   GzipFilet   StringIOt   readt   zlibt
   decompressRU   R^   t   IOErrort   errorR   t   _(   R+   t   new_contentR,   t   encodingt   e(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _decompressContentW  s    $)c         C   s  | rt  |  ƒ } t  | ƒ } | j d ƒ s< | j d ƒ rL | j | ƒ qt j j ƒ  } x3 | j ƒ  D]% \ } }	 | d k rh |	 | | <qh qh W| j }
 |
 d k r¯ d }
 n  d | j } | j ƒ  } t j	 d d	 | ƒ } d
 j
 | | | g ƒ } | j | | ƒ n  d  S(   Ns   no-storet   statuss   content-encodings   transfer-encodingi0  iÈ   s   status: %d
s   (?!
)|(?<!)
s   
R5   (   s   statuss   content-encodings   transfer-encoding(   Rt   Rk   t   deleteRŠ   t   MessageRd   R©   t	   as_stringt   reR\   RI   t   set(   R’   R‘   R,   t   cachet   cachekeyR“   R”   t   infoRg   Rh   R©   t   status_headert
   header_strt   text(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _updateCachei  s"    		c       	   C   sS   t  d t j ƒ  g  t d ƒ D] }  d t j d d ƒ ^ q f ƒ j ƒ  } | d  S(   Ns   %s:%si   t
   0123456789i    i	   i   (   RZ   R   t   ctimet   ranget   randomt	   randrangeR[   (   t   it   dig(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _cnonce‚  s    Kc         C   s,   t  j t d |  | | f ƒ j ƒ  ƒ j ƒ  S(   Ns   %s%s%s(   t   base64t   encodestringt   _shaRu   R<   (   t   cnoncet   iso_nowt   password(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _wsse_username_token†  s    t   Authenticationc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sC   t  | ƒ \ } }	 }
 } } |
 |  _ | |  _ | |  _ | |  _ d  S(   N(   RE   RL   t   hostt   credentialst   http(   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   RJ   RK   RL   RM   RN   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   “  s
    			c         C   s5   t  | ƒ \ } } } } } | t |  j ƒ j d ƒ S(   NRF   (   RE   R^   RL   t   count(   R%   RO   RJ   RK   RL   RM   RN   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   depthš  s    c         C   s:   t  | ƒ \ } } } } } | |  j k o9 | j |  j ƒ S(   N(   RE   RÆ   t
   startswithRL   (   R%   RÆ   RO   RJ   RK   RL   RM   RN   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   inscopež  s    c         C   s   d S(   sn   Modify the request headers to add the appropriate
        Authorization header. Over-rise this in sub-classes.N(    (   R%   t   methodRO   Rf   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   request£  s    c         C   s   t  S(   s  Gives us a chance to update with new nonces
        or such returned from the last authorized response.
        Over-rise this in sub-classes if necessary.

        Return TRUE is the request is to be retried, for 
        example Digest may return stale=true.
        (   t   False(   R%   R+   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR+   ¨  s    (   R(   R)   R-   RÊ   RÌ   RÎ   R+   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÅ   ’  s
   				t   BasicAuthenticationc           B   s   e  Z d  „  Z d „  Z RS(   c      	   C   s&   t  j |  | | | | | | | ƒ d  S(   N(   RÅ   R-   (   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   µ  s    c         C   s(   d t  j d |  j ƒ j ƒ  | d <d S(   sO   Modify the request headers to add the appropriate
        Authorization header.s   Basic s   %s:%st   authorizationN(   R¾   R¿   RÇ   R<   (   R%   RÍ   RO   Rf   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ   ¸  s    (   R(   R)   R-   RÎ   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÐ   ´  s   	t   DigestAuthenticationc           B   s,   e  Z d  Z d „  Z d d „ Z d „  Z RS(   sN   Only do qop='auth' and MD5, since that 
    is all Apache currently implementsc      	   C   sY  t  j |  | | | | | | | ƒ t | d ƒ } | d |  _ |  j j d d ƒ }	 d g  |	 j ƒ  D] }
 |
 j ƒ  ^ qc k r„ d p‡ d  |  j d <|  j d d  k r½ t t	 d |	 ƒ ƒ ‚ n  |  j j d d ƒ j
 ƒ  |  j d <|  j d d k rt t	 d |  j d ƒ ƒ ‚ n  d	 j |  j d
 d |  j d d |  j d g ƒ |  _ d |  j d <d  S(   Ns   www-authenticateRu   t   qopt   auths   Unsupported value for qop: %s.t	   algorithmt   MD5s$   Unsupported value for algorithm: %s.R5   i    t   :t   realmi   t   nc(   RÅ   R-   R   t	   challengeR:   R;   R<   R   R   R¤   t   upperRI   RÇ   t   A1(   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   RÚ   RÓ   R?   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   Á  s    ">" 6c   	         s  d „  ‰  ‡  f d †  } d j  | d | g ƒ } | p< t ƒ  |  j d <d | ˆ  |  j ƒ d |  j d d	 |  j d
 |  j d |  j d ˆ  | ƒ f ƒ } d |  j d |  j d |  j d | |  j d | |  j d |  j d
 |  j d f	 | d <|  j d
 c d 7<d S(   s   Modify the request headersc         S   s   t  |  ƒ j ƒ  S(   N(   RZ   R[   (   R?   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   <lambda>Ñ  s    c            s   ˆ  d |  | f ƒ S(   Ns   %s:%s(    (   t   st   d(   t   H(    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÝ   Ò  s    R5   R×   RÁ   s   "%s"s   %s:%s:%s:%s:%st   nonces   %08xRÙ   RÓ   so   Digest username="%s", realm="%s", nonce="%s", uri="%s", algorithm=%s, response=%s, qop=%s, nc=%08x, cnonce="%s"i    RØ   RÕ   t   Authorizationi   N(   RI   R½   RÚ   RÜ   RÇ   (	   R%   RÍ   RO   Rf   R,   RÁ   t   KDt   A2t   request_digest(    (   Rà   sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ   Ï  s&    	






c         C   s³   | j  d ƒ sd t | d ƒ j d i  ƒ } d | j d ƒ k r¯ | d |  j d <d |  j d <t SnK t | d ƒ j d i  ƒ } | j  d	 ƒ r¯ | d	 |  j d <d |  j d <n  t S(
   Ns   authentication-infos   www-authenticateRu   t   truet   staleRá   i   RÙ   t	   nextnonce(   Rk   R   R:   RÚ   t   TrueRÏ   (   R%   R+   R,   RÚ   t   updated_challenge(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR+   ç  s    N(   R(   R)   t   __doc__R-   R   RÎ   R+   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÒ   ¾  s   	t   HmacDigestAuthenticationc           B   s/   e  Z d  Z d Z d „  Z d „  Z d „  Z RS(   s@   Adapted from Robert Sayre's code and DigestAuthentication above.s!   Thomas Broyer (t.broyer@ltgt.net)c   	   	   C   s:  t  j |  | | | | | | | ƒ t | d ƒ } | d |  _ |  j j d d ƒ |  j d <|  j d d k r} d |  j d <n  |  j j d d ƒ |  j d <|  j j d ƒ sÀ t t d	 ƒ ƒ ‚ n  |  j j d
 d ƒ |  j d
 <|  j d
 d k rt t d |  j d
 ƒ ƒ ‚ n  |  j j d d ƒ |  j d <|  j d d k r^t t d |  j d ƒ ƒ ‚ n  |  j d
 d k r}t |  _ n	 t	 |  _ |  j d d k r¥t |  _
 n	 t	 |  _
 d j |  j d d |  j
 j d j |  j d |  j d g ƒ ƒ j ƒ  j ƒ  d |  j d g ƒ |  _ |  j
 j |  j ƒ j ƒ  j ƒ  |  _ d  S(   Ns   www-authenticatet
   hmacdigestt   reasont   unauthorizedt	   integrityt   saltR5   t   snoncesC   The challenge doesn't contain a server nonce, or this one is empty.RÕ   s
   HMAC-SHA-1s   HMAC-MD5s$   Unsupported value for algorithm: %s.s   pw-algorithms   SHA-1RÖ   s'   Unsupported value for pw-algorithm: %s.i    R×   i   RØ   (   Rï   Rð   (   s
   HMAC-SHA-1s   HMAC-MD5(   s   SHA-1s   MD5(   RÅ   R-   R   RÚ   R:   R   R¤   RZ   t   hashmodRÀ   t	   pwhashmodRI   RÇ   t   newR[   RH   Rg   (	   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   RÚ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   û  s2    "  		8c      	   C   sÿ   t  | ƒ } d j g  | D] } d | ^ q ƒ } d j g  | D] } | | ^ q? ƒ } t j d t j ƒ  ƒ }	 t ƒ  }
 d | | |
 |  j d | f } t j |  j	 | |  j
 ƒ j ƒ  j ƒ  } d |  j d |  j d |  j d |
 | |	 | | f | d	 <d
 S(   s   Modify the request headersR5   s   %s s   %Y-%m-%dT%H:%M:%SZs   %s:%s:%s:%s:%sRò   ss   HMACDigest username="%s", realm="%s", snonce="%s", cnonce="%s", uri="%s", created="%s", response="%s", headers="%s"i    RØ   Râ   N(   RA   RI   R   t   strftimet   gmtimeR½   RÚ   t   hmacRõ   Rg   Ró   R[   RH   RÇ   (   R%   RÍ   RO   Rf   R,   R=   t   kt   keylistt   headers_valt   createdRÁ   Rå   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ     s     &&	 '


c         C   s8   t  | d ƒ j d i  ƒ } | j d ƒ d k r4 t St S(   Ns   www-authenticateRí   Rî   Rð   Rç   (   s	   integritys   stale(   R   R:   Ré   RÏ   (   R%   R+   R,   RÚ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR+   .  s    (   R(   R)   Rë   t
   __author__R-   RÎ   R+   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRì   ÷  s
   		t   WsseAuthenticationc           B   s    e  Z d  Z d „  Z d „  Z RS(   s¼  This is thinly tested and should not be relied upon.
    At this time there isn't any third party server to test against.
    Blogger and TypePad implemented this algorithm at one point
    but Blogger has since switched to Basic over HTTPS and 
    TypePad has implemented it wrong, by never issuing a 401
    challenge but instead requiring your client to telepathically know that
    their endpoint is expecting WSSE profile="UsernameToken".c      	   C   s&   t  j |  | | | | | | | ƒ d  S(   N(   RÅ   R-   (   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   =  s    c         C   si   d | d <t  j d t  j ƒ  ƒ } t ƒ  } t | | |  j d ƒ } d |  j d | | | f | d <d S(	   sO   Modify the request headers to add the appropriate
        Authorization header.s   WSSE profile="UsernameToken"Râ   s   %Y-%m-%dT%H:%M:%SZi   sJ   UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"i    s   X-WSSEN(   R   Rö   R÷   R½   RÄ   RÇ   (   R%   RÍ   RO   Rf   R,   RÂ   RÁ   t   password_digest(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ   @  s    
	
(   R(   R)   Rë   R-   RÎ   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRþ   5  s   	t   GoogleLoginAuthenticationc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sW  d d l  m } t j |  | | | | | | | ƒ t | d ƒ }	 |	 d j d d ƒ }
 |
 d k r | j d ƒ d k r d	 }
 n  t d
 | d d | d d |
 d | d ƒ } |  j j	 d d d d | | ƒ d i d d 6ƒ\ } } | j
 d ƒ } t g  | D]$ } | rþ t | j
 d d ƒ ƒ ^ qþ ƒ } | j d k rFd |  _ n | d |  _ d  S(   Niÿÿÿÿ(   t	   urlencodes   www-authenticatet   googlelogint   servicet   xapiRˆ   i    t   clt   Emailt   Passwdi   t   sources
   user-agents+   https://www.google.com/accounts/ClientLoginRÍ   t   POSTt   bodyRf   s!   application/x-www-form-urlencodeds   Content-Types   
Rj   i“  R5   t   Auth(   t   urllibR  RÅ   R-   R   R:   Rl   Rc   RÈ   RÎ   R;   Rm   R©   R  (   R%   RÇ   RÆ   RO   Rf   R+   R,   RÈ   R  RÚ   R  RÔ   t   respt   linest   lineRß   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   N  s    "!	-77c         C   s   d |  j  | d <d S(   sO   Modify the request headers to add the appropriate
        Authorization header.s   GoogleLogin Auth=RÑ   N(   R  (   R%   RÍ   RO   Rf   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ   d  s    (   R(   R)   R-   RÎ   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   M  s   	t   basict   wsseRu   Rí   R  t	   FileCachec           B   s5   e  Z d  Z e d „ Z d „  Z d „  Z d „  Z RS(   s¤   Uses a local directory as a store for cached files.
    Not really safe to use if multiple threads or processes are going to 
    be running on the same cache.
    c         C   s;   | |  _  | |  _ t j j | ƒ s7 t j |  j  ƒ n  d  S(   N(   R¯   t   safet   osRL   t   existst   makedirs(   R%   R¯   R  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   y  s    		c         C   sh   d  } t j j |  j |  j | ƒ ƒ } y) t | d ƒ } | j ƒ  } | j ƒ  Wn t	 k
 rc n X| S(   Nt   rb(
   R   R  RL   RI   R¯   R  t   fileRŸ   t   closeR¢   (   R%   Rg   Rn   t   cacheFullPatht   f(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR:     s    !c         C   sK   t  j j |  j |  j | ƒ ƒ } t | d ƒ } | j | ƒ | j ƒ  d  S(   Nt   wb(   R  RL   RI   R¯   R  R  t   writeR  (   R%   Rg   Rh   R  R  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR®   Š  s    !c         C   sG   t  j j |  j |  j | ƒ ƒ } t  j j | ƒ rC t  j | ƒ n  d  S(   N(   R  RL   RI   R¯   R  R  t   remove(   R%   Rg   R  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRª     s    !(   R(   R)   Rë   Ra   R-   R:   R®   Rª   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR  t  s
   		t   Credentialsc           B   s/   e  Z d  „  Z d d „ Z d „  Z d „  Z RS(   c         C   s   g  |  _  d  S(   N(   RÇ   (   R%   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   –  s    R5   c         C   s#   |  j  j | j ƒ  | | f ƒ d  S(   N(   RÇ   t   appendRH   (   R%   Rr   RÃ   t   domain(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   add™  s    c         C   s   g  |  _  d  S(   N(   RÇ   (   R%   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   clearœ  s    c         c   sG   x@ |  j  D]5 \ } } } | d k s1 | | k r
 | | f Vq
 q
 Wd  S(   NR5   (   RÇ   (   R%   R!  t   cdomainRr   RÃ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   iterŸ  s    (   R(   R)   R-   R"  R#  R%  (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR  •  s   		t   KeyCertsc           B   s   e  Z d  Z RS(   sN   Identical to Credentials except that
    name/password are mapped to key/cert.(   R(   R)   Rë   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR&  ¤  s   c           B   s2   e  Z d  Z d d d d „ Z d „  Z d „  Z RS(   s,   Collect information required to use a proxy.c         C   s@   | | | | | | f \ |  _  |  _ |  _ |  _ |  _ |  _ d S(   sÂ   The parameter proxy_type must be set to one of socks.PROXY_TYPE_XXX
      constants. For example:

p = ProxyInfo(proxy_type=socks.PROXY_TYPE_HTTP, proxy_host='localhost', proxy_port=8000)
      N(   t
   proxy_typet
   proxy_hostt
   proxy_portt
   proxy_rdnst
   proxy_usert
   proxy_pass(   R%   R'  R(  R)  R*  R+  R,  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   ¬  s    c         C   s(   |  j  |  j |  j |  j |  j |  j f S(   N(   R'  R(  R)  R*  R+  R,  (   R%   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   astuple´  s    c         C   s"   t  o! |  j d  k o! |  j d  k S(   N(   t   socksR(  R   R)  (   R%   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   isgood¸  s    N(   R(   R)   Rë   R   R-   R-  R/  (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   ª  s   	t   HTTPConnectionWithTimeoutc           B   s,   e  Z d  Z d d d d d „ Z d „  Z RS(   s.   HTTPConnection subclass that supports timeoutsc         C   s/   t  j j |  | | | ƒ | |  _ | |  _ d  S(   N(   R   t   HTTPConnectionR-   R   t
   proxy_info(   R%   RÆ   t   portt   strictR   R2  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   ¿  s    	c         C   s  d } xht  j |  j |  j d t  j ƒ D]E} | \ } } } } } yÄ |  j r’ |  j j ƒ  r’ t j | | | ƒ |  _	 |  j	 j
 |  j j ƒ  Œ  n t  j  | | | ƒ |  _	 t |  j ƒ rÏ |  j	 j |  j ƒ n  |  j d k rö d |  j |  j f GHn  |  j	 j | ƒ Wnb t  j k
 rk} |  j d k rCd G|  j |  j f GHn  |  j	 r\|  j	 j ƒ  n  d |  _	 q( n XPq( W|  j	 s‰t  j | ‚ n  d S(   s3   Connect to the host and port specified in __init__.s!   getaddrinfo returns an empty listi    s   connect: (%s, %s)s   connect fail:N(   R   t   getaddrinfoRÆ   R3  t   SOCK_STREAMR2  R/  R.  t
   socksocketR	   t   setproxyR-  R   R   t
   settimeoutR   t   connectR£   R  R   (   R%   R"   t   rest   aft   socktypet   protot	   canonnamet   sa(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR:  Ä  s0    			N(   R(   R)   Rë   R   R-   R:  (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR0  ¼  s   t   HTTPSConnectionWithTimeoutc           B   s2   e  Z d  Z d d d d d d d „ Z d „  Z RS(   s(   This class allows communication via SSL.c         C   sA   t  j j |  | d | d | d | d | ƒ| |  _ | |  _ d  S(   NR3  R
   R   R4  (   R   t   HTTPSConnectionR-   R   R2  (   R%   RÆ   R3  R
   R   R4  R   R2  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-   ç  s    	c         C   s»   |  j  rI |  j  j ƒ  rI t j t j t j ƒ } | j |  j  j ƒ  Œ  n t j t j t j ƒ } t	 |  j
 ƒ rƒ | j |  j
 ƒ n  | j |  j |  j f ƒ t | |  j |  j ƒ |  _ d S(   s(   Connect to a host on a given (SSL) port.N(   R2  R/  R.  R7  R   t   AF_INETR6  R8  R-  R   R   R9  R:  RÆ   R3  R   R
   R   R	   (   R%   R	   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR:  î  s    N(   R(   R)   Rë   R   R-   R:  (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRA  ä  s   	c           B   sq   e  Z d  Z d d d d „ Z d „  Z d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d	 d d e d d
 „ Z RS(   s{   An HTTP client that handles:
- all methods
- caching
- ETags
- compression,
- HTTPS
- Basic
- Digest
- WSSE

and more.
    c         C   s    | |  _  i  |  _ | r9 t | t ƒ r9 t | ƒ |  _ n	 | |  _ t ƒ  |  _ t ƒ  |  _	 g  |  _
 t |  _ d g |  _ t |  _ t |  _ t |  _ | |  _ d S(   sÌ   The value of proxy_info is a ProxyInfo instance.

If 'cache' is a string then it is used as a directory name
for a disk cache. Otherwise it must be an object that supports
the same interface as FileCache.t   PUTN(   R2  t   connectionsRT   RU   R  R¯   R  RÇ   R&  t   certificatest   authorizationsRé   t   follow_redirectst   optimistic_concurrency_methodsRÏ   t   follow_all_redirectst   ignore_etagt   force_exception_to_status_codeR   (   R%   R¯   R   R2  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-     s    								c   	   
   c   st   t  | d ƒ } x^ |  j j | ƒ D]J } xA t D]9 } | j | ƒ r/ t | | | | | | | |  ƒ Vq/ q/ Wq" Wd S(   sc   A generator that creates Authorization objects
           that can be applied to requests.
        s   www-authenticateN(   R   RÇ   R%  t   AUTH_SCHEME_ORDERRk   t   AUTH_SCHEME_CLASSES(	   R%   RÆ   RO   Rf   R+   R,   t
   challengest   credRJ   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _auth_from_challenge5  s
    R5   c         C   s   |  j  j | | | ƒ d S(   s]   Add a name and password that will be used
        any time a request requires authentication.N(   RÇ   R"  (   R%   Rr   RÃ   R!  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   add_credentials?  s    c         C   s   |  j  j | | | ƒ d S(   sX   Add a key and cert that will be used
        any time a request requires authentication.N(   RF  R"  (   R%   Rg   t   certR!  (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   add_certificateD  s    c         C   s   |  j  j ƒ  g  |  _ d S(   sK   Remove all the names and passwords
        that are used for authenticationN(   RÇ   R#  RG  (   R%   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   clear_credentialsI  s    c   	      C   s0  x#t  d ƒ D]} y | j | | | | ƒ WnM t j k
 r` | j ƒ  t d | j ƒ ‚ n t j t j	 f k
 r| n Xy | j
 ƒ  } WnF t j t j	 f k
 rÕ | d k rÏ | j ƒ  | j ƒ  q q!‚  nL Xd } | d k r÷ | j ƒ  } n  t | ƒ } | d k r!t | | ƒ } n  Pq W| | f S(   Ni   s   Unable to find the server at %si    R5   t   HEAD(   R¸   RÎ   R   t   gaierrorR  R0   RÆ   R£   R   t   HTTPExceptiont   getresponseR:  RŸ   R   R¨   (	   R%   t   connRO   RÍ   R
  Rf   R»   R+   R,   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _conn_requestO  s0    


c
         C   s5  g  |  j  D]- }
 |
 j | | ƒ r
 |
 j | ƒ |
 f ^ q
 } | rW t | ƒ d d pZ d }
 |
 r| |
 j | | | | ƒ n  | j ƒ  |  j | | | | | ƒ \ } } |
 r|
 j | | ƒ r|
 j | | | | ƒ |  j | | | | | ƒ \ } } d | _	 qn  | j
 d k r§x |  j | | | | | ƒ D]p } | j | | | | ƒ |  j | | | | | ƒ \ } } | j
 d k r0|  j  j | ƒ | j | | ƒ Pq0q0Wn  |  j sË| d k sË| j
 d k r+|  j rÕ| j
 d k rÕ| rº| j d ƒ r#| j
 d k r#t t d ƒ | | ƒ ‚ n  | j d ƒ r| d } t | ƒ \ } } } } } | d k rt j | | ƒ | d <qn  | j
 d k rà| d k rà| d | d <| j d ƒ sÄ| | d <n  t | | | |  j |	 ƒ n  | j d ƒ rù| d =n  | j d ƒ r| d =n  | j d ƒ rÒ| d } t j | ƒ } | j d ƒ sV| | d <n  | j
 d k rw| d k rwd pz| } |  j | | d | d | d | d ƒ\ } } | | _ qÒq(t t d ƒ | | ƒ ‚ q+| j
 d k r+| d k r+| j d ƒ s| | d <n  t | | | |  j |	 ƒ q+n  | | f S(   sm   Do the actual request using the connection object
        and also follow one level of redirects if necessaryi    i   i‘  t   GETRV  i/  i,  i-  i.  i3  t   locations:   Redirected but the response is missing a Location: header.s   -x-permanent-redirect-urls   content-locations   if-none-matchs   if-modified-sinceR
  Rf   t   redirectionss3   Redirected more times than rediection_limit allows.iÈ   iË   N(   s   GETs   HEAD(   i,  i-  i.  i/  i3  (   s   GETs   HEAD(   s   GETs   HEAD(   iÈ   iË   (   RG  RÌ   RÊ   R!   R   RÎ   R:  R[  R+   t   _stale_digestR©   RQ  R   RJ  RH  Rk   R   R¤   RE   t   urlparset   urljoinRµ   R¯   t   copyt   deepcopyt   previousR   (   R%   RZ  RÆ   t   absolute_uriRO   RÍ   R
  Rf   R^  R°   RÔ   t   authsR+   R,   RÑ   R]  RJ   RK   RL   RM   RN   t   old_responset   redirect_method(    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   _requestn  sh    = 
!!"!$



'.R\  c         C   sÙ  yç| d. k r i  } n t | ƒ } | j d ƒ sD d t | d <n  t | ƒ } t | ƒ \ } } }	 }
 | j d ƒ d d !} t | ƒ d k r¿ | d d k r¿ | d k r¿ d	 } | d } n  | d | } | |  j k rì |  j | } nÉ | s| d	 k rt	 pt
 } n  t |  j j | ƒ ƒ } | d	 k r| r| | d
 | d d d | d d d |  j d |  j ƒ} |  j | <n) | | d |  j d |  j ƒ} |  j | <| j t ƒ | d/ k ræd | k ræd | k ræd | d <n  t j j ƒ  } d. } |  j r¥|
 } |  j j | ƒ } | r«yM | j d d ƒ \ } } t j j ƒ  } | j | ƒ | j ƒ  } d. | _ Wq¢t k
 rž|  j j | ƒ d. } d. } q¢Xq«n d. } | |  j k rù|  j rù| j d ƒ rù|  j rùd | k rù| d | d <n  | d0 k r'|  j r'| r'|  j j | ƒ n  | r| d1 k r|  j rd | k r| j d ƒ r§|  j | d d d | d | d ƒ\ } } t | ƒ | _  t! | j  _" n	t# | | ƒ } | d k r| sÛd | d <d } n  t | ƒ } | rùt! | _" n  | | f S| d k rt| j d ƒ rE|  j rEd | k rE| d | d <n  | j d ƒ rƒd | k rƒ| d | d  <qƒn | d! k rƒn  |  j$ | | | |	 | | | | | ƒ	 \ } } | j% d" k rN| d k rNx" t& | ƒ D] } | | | | <qØWt | ƒ } t' | d# ƒ r| j( | _( n  t) | | | |  j | ƒ | } d$ | _% t! | _" qæ| j% d$ k rf| } qæ|  j j | ƒ | } ng t* | ƒ } | j d% ƒ r¹d | d <t | ƒ } d } n- |  j$ | | | |	 | | | | | ƒ	 \ } } Wnå t+ k
 rÎ} |  j, rÈt- | t. ƒ r>| j/ } | j0 } d& | _% t1 | ƒ | _2 qËt- | t3 j ƒ r‰d' } t i d( d) 6d* d 6t | ƒ d+ 6ƒ } d' | _2 qËt1 | ƒ } t i d( d) 6d, d 6t | ƒ d+ 6ƒ } d- | _2 qÏ‚  n X| | f S(2   s    Performs a single HTTP request.
The 'uri' is the URI of the HTTP resource and can begin 
with either 'http' or 'https'. The value of 'uri' must be an absolute URI.

The 'method' is the HTTP method to perform, such as GET, POST, DELETE, etc. 
There is no restriction on the methods allowed.

The 'body' is the entity body to be sent with the request. It is a string
object.

Any extra headers that are to be sent with the request should be provided in the
'headers' dictionary.

The maximum number of redirect to follow before raising an 
exception is 'redirections. The default is 5.

The return value is a tuple of (response, content), the first 
being and instance of the 'Response' class, the second being 
a string that contains the response entity body.
        s
   user-agents   Python-httplib2/%sR×   i    i   i   t   443RÈ   t   httpsR
   R   R   R2  R\  RV  R¸   s   accept-encodings   deflate, gzips   

t   etags   if-matchs   -x-permanent-redirect-urlRf   R^  R…   t   504R©   R5   R‚   s   if-none-matchs   last-modifieds   if-modified-sinceR„   i0  R_  iÈ   s   only-if-cachediô  s   Request Timeouts
   text/plains   content-typet   408s   content-lengtht   400s   Bad RequestN(   s   GETs   HEAD(   s   GETs   HEAD(   s   GETs   HEAD(4   R   Ri   Rk   t   __version__R   RQ   R;   R^   RE  RA  R0  R7   RF  R%  R   R2  t   set_debuglevelR   RŠ   R«   R¯   R:   t
   FeedParsert   feedR  t   _parset
   IndexErrorRª   RI  RK  RÎ   R   Rd  Ré   t	   fromcacheR™   Ri  R©   RA   R   R_  Rµ   Rt   t	   ExceptionRL  RT   R*   R+   R,   RU   Rî   R   (   R%   R   RÍ   R
  Rf   R^  t   connection_typeRJ   RK   RO   RP   t   domain_portt   conn_keyRZ  t   certsR±   t   cached_valueR°   R,   t
   feedparserR+   R¥   t   entry_dispositionRg   t   merged_responseR“   R§   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyRÎ   ·  sÜ    	.1)$	=',

	
%-			
	1				N(   R(   R)   Rë   R   R-   RQ  RR  RT  RU  R[  Ri  t   DEFAULT_MAX_REDIRECTSRÎ   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   þ  s   *	
				Ic           B   s>   e  Z d  Z e Z d Z d Z d Z d Z	 d „  Z
 d „  Z RS(   s<   An object more like email.Message than httplib.HTTPResponse.i   iÈ   t   Okc         C   s  t  | t j ƒ ry x* | j ƒ  D] \ } } | |  | j ƒ  <q W| j |  _ t |  j ƒ |  d <| j |  _ | j |  _ n— t  | t	 j
 j
 ƒ rË x$ | j ƒ  D] \ } } | |  | <q› Wt |  d ƒ |  _ nE x$ | j ƒ  D] \ } } | |  | <qØ Wt |  j d |  j ƒ ƒ |  _ d  S(   NR©   (   RT   R   t   HTTPResponseR'   RH   R©   RU   Rî   t   versionRŠ   R«   R$   R   Rd   R:   (   R%   R±   Rg   Rh   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR-     s    c         C   s   | d k r |  St  | ‚ d  S(   NRc   (   t   AttributeError(   R%   Rr   (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   __getattr__“  s    N(   R(   R)   Rë   RÏ   Rv  Rƒ  R©   Rî   R   Rd  R-   R…  (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyR   n  s   	(h   t
   __future__R    Rý   t   __copyright__t   __contributors__t   __license__Rp  R­   t   sysRŠ   t   email.Utilst   email.Messaget   email.FeedParserRž   Rš   R    R   R`  R¾   R  Rb  Rˆ   R   R¹   t   hashlibR   RÀ   R   RZ   t   ImportErrort   shaRõ   Rø   R   R¤   R   R.  R   R   t   wrap_socketR   t   version_infoR   R   t   __all__R   R!   R&   R   R‚  R'   Rw  R   R*   R   R   R   R   R   R/   R0   R€  R8   RA   t   compileRB   RE   RQ   RS   R]   Ra   Re   Ri   Rt   Rv   Rw   Rx   Rz   R   R™   R¨   Rµ   R½   RÄ   t   objectRÅ   RÐ   RÒ   Rì   Rþ   R   RN  RM  R  R  R&  R   R1  R0  RB  RA  R   Rc   R   (    (    (    sL   /home/sa3ruby/intertwingly.net/code/venus/planet/vendor/httplib2/__init__.pyt   <module>   sä   		
												J				"
9>
!(ÿ q