Files
old-nlp/venv/lib/python3.7/site-packages/requests/__pycache__/auth.cpython-37.pyc

63 lines
8.1 KiB
Plaintext
Raw Normal View History

2019-10-20 13:16:49 +02:00
B
T%<25>]<5D>'<00>@s<>dZddlZddlZddlZddlZddlZddlZddlmZddl m
Z
m Z m Z ddl mZddlmZddlmZd Zd
Zd d <0C>ZGd d<0E>de<16>ZGdd<10>de<17>ZGdd<12>de<18>ZGdd<14>de<17>ZdS)z]
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
<EFBFBD>N)<01> b64encode<64>)<03>urlparse<73>str<74>
basestring)<01>extract_cookies_to_jar)<01>to_native_string)<01>parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCs<>t|t<01>s&tjd<01>|<00>td<02>t|<00>}t|t<01>sLtjd<03>|<01>td<02>t|<01>}t|t<06>r`|<00>d<04>}t|t<06>rt|<01>d<04>}dtt d<06>
||f<02><01><01> <0B><00>}|S)zReturns a Basic Auth string.z<>Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.)<01>categoryz<79>Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.<2E>latin1zBasic <20>:) <0C>
isinstancer<00>warnings<67>warn<72>format<61>DeprecationWarningr<00>encoderr<00>join<69>strip)<03>username<6D>password<72>authstr<74>r<00>3/tmp/pip-install-_zqls8j0/requests/requests/auth.py<70>_basic_auth_strs&





rc@seZdZdZdd<03>ZdS)<05>AuthBasez4Base class that all auth implementations derive fromcCs td<01><01>dS)NzAuth hooks must be callable.)<01>NotImplementedError)<02>self<6C>rrrr<00>__call__KszAuthBase.__call__N)<05>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrrrrrHsrc@s0eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
S) <0B> HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS)N)rr)rrrrrr<00>__init__RszHTTPBasicAuth.__init__cCs(t|jt|dd<00>k|jt|dd<00>kg<02>S)Nrr)<04>allr<00>getattrr)r<00>otherrrr<00>__eq__VszHTTPBasicAuth.__eq__cCs
||k S)Nr)rr(rrr<00>__ne__\szHTTPBasicAuth.__ne__cCst|j|j<02>|jd<|S)N<> Authorization)rrr<00>headers)rrrrrr_szHTTPBasicAuth.__call__N)r r!r"r#r%r)r*rrrrrr$Os
r$c@seZdZdZdd<03>ZdS)<05> HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|j<02>|jd<|S)NzProxy-Authorization)rrrr,)rrrrrrgszHTTPProxyAuth.__call__N)r r!r"r#rrrrrr-dsr-c@sPeZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dd<0F>Z
dd<11>Z dS)<13>HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_t<02><03>|_dS)N)rr<00> threading<6E>local<61> _thread_local)rrrrrrr%oszHTTPDigestAuth.__init__cCs@t|jd<01>s<d|j_d|j_d|j_i|j_d|j_d|j_dS)N<>initT<74>r)<08>hasattrr1r2<00>
last_nonce<EFBFBD> nonce_count<6E>chal<61>pos<6F> num_401_calls)rrrr<00>init_per_thread_stateus z$HTTPDigestAuth.init_per_thread_statecs<>|jjd}|jjd}|jj<01>d<03>}|jj<01>d<04>}|jj<01>d<05>}d<06>|dkrTd}n|<06><03>}|dksl|dkrzd d
<EFBFBD>} | <09>n@|d kr<>d d <0A>}
|
<EFBFBD>n*|dkr<>dd<10>} | <0B>n|dkr<>dd<13>} | <0C><00>fdd<15>} <0A>dkr<>dSd}t|<02>}|jp<>d}|jr<>|d|j7}d|j||jf}d||f}<12>|<11>}<13>|<12>}||jj k<02>rJ|jj
d7_
nd|j_
d|jj
}t |jj
<EFBFBD><01> d<1C>}||<04> d<1C>7}|t <0A><0E><00> d<1C>7}|t<0F>d<1D>7}t<11>|<16><01><13>dd<1E>}|dk<02>rЈd|||f<00>}|<05>s<>| |d||f<00>}n<|dk<02>sd|<05>d <20>k<06>r"d!|||d|f}| ||<19>}ndS||j_ d"|j||||f}|<07>rT|d#|7}|<06>rf|d$|7}|<0E>rx|d%|7}|<05>r<>|d&||f7}d'|S)(z
:rtype: str
<20>realm<6C>nonce<63>qop<6F> algorithm<68>opaqueN<65>MD5zMD5-SESScSs"t|t<01>r|<00>d<01>}t<03>|<00><01><05>S)Nzutf-8)r rr<00>hashlib<69>md5<64> hexdigest)<01>xrrr<00>md5_utf8<66>s

z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8<66>SHAcSs"t|t<01>r|<00>d<01>}t<03>|<00><01><05>S)Nzutf-8)r rrrA<00>sha1rC)rDrrr<00>sha_utf8<66>s

z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8zSHA-256cSs"t|t<01>r|<00>d<01>}t<03>|<00><01><05>S)Nzutf-8)r rrrA<00>sha256rC)rDrrr<00> sha256_utf8<66>s

z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8zSHA-512cSs"t|t<01>r|<00>d<01>}t<03>|<00><01><05>S)Nzutf-8)r rrrA<00>sha512rC)rDrrr<00> sha512_utf8<66>s

z7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8cs<00>d||f<00>S)Nz%s:%sr)<02>s<>d)<01> hash_utf8rr<00><lambda><3E><00>z4HTTPDigestAuth.build_digest_header.<locals>.<lambda><3E>/<2F>?z%s:%s:%sz%s:%srz%08xzutf-8<><00><00>auth<74>,z%s:%s:%s:%s:%sz>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"z , opaque="%s"z, algorithm="%s"z , digest="%s"z , qop="auth", nc=%s, cnonce="%s"z Digest %s)r1r7<00>get<65>upperr<00>path<74>queryrrr5r6rr<00>time<6D>ctime<6D>os<6F>urandomrArGrC<00>split)r<00>method<6F>urlr;r<r=r>r?<00>
_algorithmrErHrJrL<00>KD<4B>entdig<69>p_parsedrZ<00>A1<41>A2<41>HA1<41>HA2<41>ncvaluerM<00>cnonce<63>respdig<69>noncebit<69>baser)rOr<00>build_digest_headers~   
  
    z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)<03> is_redirectr1r9)rr<00>kwargsrrr<00>handle_redirect<63>szHTTPDigestAuth.handle_redirectcKs"d|jkrdks$nd|j_|S|jjdk rB|jj<05>|jj<03>|j<07>dd<06>}d|<03> <09>k<06>r|jjdk<00>r|jjd7_t
j d t
j d
<EFBFBD>}t |jd|dd <0B><03>|j_|j|<01><11>|j<04><12>}t|j|j|j<15>|<05>|j<14>|<00>|j|j<19>|jd <|jj|f|<02>}|j<1C>|<01>||_|Sd|j_|S) zo
Takes the given response and tries digest-auth, if needed.
:rtype: requests.Response
i<>i<>rNzwww-authenticater3<00>digest<73>zdigest )<01>flags)<01>countr+)<1E> status_coder1r9r8<00>request<73>body<64>seekr,rX<00>lower<65>re<72>compile<6C>
IGNORECASEr <00>subr7<00>content<6E>close<73>copyr<00>_cookies<65>raw<61>prepare_cookiesrprarb<00>
connection<EFBFBD>send<6E>history<72>append)rrrr<00>s_auth<74>pat<61>prep<65>_rrrr<00>
handle_401<EFBFBD>s.  
  zHTTPDigestAuth.handle_401cCs~|<00><00>|jjr&|<00>|j|j<05>|jd<y|j<07><08>|j_ Wnt
k
rTd|j_ YnX|<01> d|j <0C>|<01> d|j <0A>d|j_|S)Nr+<00>responser)r:r1r5rprarbr,rz<00>tellr8<00>AttributeError<6F> register_hookr<6B>rsr9)rrrrrrszHTTPDigestAuth.__call__cCs(t|jt|dd<00>k|jt|dd<00>kg<02>S)Nrr)r&rr'r)rr(rrrr)*szHTTPDigestAuth.__eq__cCs
||k S)Nr)rr(rrrr*0szHTTPDigestAuth.__ne__N) r r!r"r#r%r:rprsr<>rr)r*rrrrr.ls
f,r.)r#r^r}r\rAr/r<00>base64r<00>compatrrr<00>cookiesr<00>_internal_utilsr<00>utilsr <00>CONTENT_TYPE_FORM_URLENCODED<45>CONTENT_TYPE_MULTI_PARTr<00>objectrr$r-r.rrrr<00><module>s$    ,