�
ӵ Yc @ so d Z d d l m Z d d l m Z d d l m Z m Z d e j f d � � YZ d e f d � � YZ
d
S( s- The module containing the code for GuessAuth.i����( t auth( t cookiesi ( t _digest_auth_compatt http_proxy_digestt GuessAuthc B s; e Z d Z d � Z d � Z d � Z d � Z d � Z RS( s7 Guesses the auth type by the WWW-Authentication header.c C s( | | _ | | _ d | _ d | _ d S( N( t usernamet passwordt NoneR t pos( t selfR R ( ( s@ /usr/lib/python2.7/site-packages/requests_toolbelt/auth/guess.pyt __init__ s c C s� | j d k r( | j j j | j � n | j | j j � | j j � } t | d � sl t
j � | _ n t
j
| j | j | j � | j | j � t j | j | j � | _ | j | � } | j j | | � } | j j | � | | _ | S( Nt _cookies( R R t requestt bodyt seekt contentt rawt release_connt copyt hasattrR t RequestsCookieJarR t extract_cookies_to_jart prepare_cookiesR t
HTTPBasicAuthR R t
connectiont sendt historyt append( R t rt kwargst prept _r( ( s@ /usr/lib/python2.7/site-packages/requests_toolbelt/auth/guess.pyt _handle_basic_auth_401 s
c C s� t j | j | j � | _ y | j j � Wn t k
r? n Xt | j d � rs | j j d k rs d | j _ n | j j
| | � S( Nt
num_401_callsi ( t auth_compatt HTTPDigestAuthR R R t init_per_thread_statet AttributeErrorR R! R t
handle_401( R R R ( ( s@ /usr/lib/python2.7/site-packages/requests_toolbelt/auth/guess.pyt _handle_digest_auth_401'