Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
usr
/
lib
/
python2.7
/
site-packages
/
requests
/
File Content:
auth.pyc
� "tVc @ s 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 m Z d d l m Z m Z d d l m Z d d l m Z m Z d d l m Z d Z d Z d � Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( s] requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. i����N( t b64encodei ( t urlparset str( t extract_cookies_to_jar( t parse_dict_headert to_native_string( t codess! application/x-www-form-urlencodeds multipart/form-datac C s3 d t t d | | f j d � � j � � } | S( s Returns a Basic Auth string.s Basic s %s:%st latin1( R R t encodet strip( t usernamet passwordt authstr( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt _basic_auth_str s )t AuthBasec B s e Z d Z d � Z RS( s4 Base class that all auth implementations derive fromc C s t d � � d S( Ns Auth hooks must be callable.( t NotImplementedError( t selft r( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt __call__( s ( t __name__t __module__t __doc__R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR % s t HTTPBasicAuthc B s e Z d Z d � Z d � Z RS( s? Attaches HTTP Basic Authentication to the given Request object.c C s | | _ | | _ d S( N( R R ( R R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt __init__. s c C s t | j | j � | j d <| S( Nt Authorization( R R R t headers( R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 2 s ( R R R R R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR , s t HTTPProxyAuthc B s e Z d Z d � Z RS( s= Attaches HTTP Proxy Authentication to a given Request object.c C s t | j | j � | j d <| S( Ns Proxy-Authorization( R R R R ( R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 9 s ( R R R R ( ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR 7 s t HTTPDigestAuthc B sD e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z RS( s@ Attaches HTTP Digest Authentication to the given Request object.c C s% | | _ | | _ t j � | _ d S( N( R R t threadingt localt _thread_local( R R R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyR @ s c C sa t | j d � s] t | j _ d | j _ d | j _ i | j _ d | j _ d | j _ n d S( Nt initt i ( t hasattrR t TrueR t last_noncet nonce_countt chalt Nonet post num_401_calls( R ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt init_per_thread_stateF s c sH | j j d } | j j d } | j j j d � } | j j j d � } | j j j d � } | d k rt d } n | j � } | d k s� | d k r� d � } | � n | d k r� d � } | � n � f d � } � d k r� d Sd } t | � } | j pd } | j r%| d | j 7} n d | j | | j f } d | | f } � | � } � | � } | | j j k r�| j j d 7_ n d | j _ d | j j } t | j j � j d � } | | j d � 7} | t j � j d � 7} | t j d � 7} t j | � j � d } | d k rD� d | | | f � } n | sf| | d | | f � } nP | d k s�d | j d � k r�d | | | d | f } | | | � } n d S| | j _ d | j | | | | f } | r�| d | 7} n | r| d | 7} n | r#| d | 7} n | r@| d | | f 7} n d | S( Nt realmt noncet qopt algorithmt opaquet MD5s MD5-SESSc S s4 t | t � r! | j d � } n t j | � j � S( Ns utf-8( t isinstanceR R t hashlibt md5t hexdigest( t x( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt md5_utf8^ s t SHAc S s4 t | t � r! | j d � } n t j | � j � S( Ns utf-8( R0 R R R1 t sha1R3 ( R4 ( ( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt sha_utf8d s c s � d | | f � S( Ns %s:%s( ( t st d( t hash_utf8( s1 /usr/lib/python2.7/site-packages/requests/auth.pyt <lambda>j s t /t ?s %s:%s:%ss %s:%si s %08xs utf-8i i t autht ,s %s:%s:%s:%s:%ss>