Files
PowerToys/PythonHome/Lib/site-packages/requests/auth.pyc

37 lines
7.5 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
G<12>Sc@s<>dZddlZddlZddlZddlZddlmZddlmZm Z ddl
m Z ddl m Z dZd Zd
<00>Zd efd <00><00>YZd efd<00><00>YZdefd<00><00>YZdefd<00><00>YZdS(s]
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
i<EFBFBD><EFBFBD><EFBFBD><EFBFBD>N(t b64encodei(turlparsetstr(textract_cookies_to_jar(tparse_dict_headers!application/x-www-form-urlencodedsmultipart/form-datacCs0dtd||fjd<00><00>j<00>jd<00>S(sReturns a Basic Auth string.sBasic s%s:%stlatin1(Rtencodetstriptdecode(tusernametpassword((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt_basic_auth_strstAuthBasecBseZdZd<00>ZRS(s4Base class that all auth implementations derive fromcCstd<00><00>dS(NsAuth hooks must be callable.(tNotImplementedError(tselftr((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt__call__"s(t__name__t
__module__t__doc__R(((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR st HTTPBasicAuthcBs eZdZd<00>Zd<00>ZRS(s?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS(N(R R
(RR R
((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt__init__(s cCs t|j|j<00>|jd<|S(Nt Authorization(R R R
theaders(RR((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR,s(RRRRR(((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR&s t HTTPProxyAuthcBseZdZd<00>ZRS(s=Attaches HTTP Proxy Authentication to a given Request object.cCs t|j|j<00>|jd<|S(NsProxy-Authorization(R R R
R(RR((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR3s(RRRR(((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR1stHTTPDigestAuthcBs2eZdZd<00>Zd<00>Zd<00>Zd<00>ZRS(s@Attaches HTTP Digest Authentication to the given Request object.cCs:||_||_d|_d|_i|_d|_dS(Nti(R R
t
last_noncet nonce_counttchaltNonetpos(RR R
((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR:s      cs'|jd}|jd}|jjd<00>}|jjd<00>}|jjd<00>}|dkred}n |j<00>}|dks<>|dkr<>d<00>} | <00>n|d kr<>d
<00>}
|
<00>n<00>fd <00>} <00>dkr<>dSd} t|<00>} | j}| jr|d | j7}nd |j||jf}d||f}<00>|<00>}<00>|<00>}||j krr|j
d7_
n d|_
d|j
}t |j
<00>j d<00>}||j d<00>7}|t j<00>j d<00>7}|tjd<00>7}tj|<00>j<00>d }d|||||f}|dkr9<02>d |||f<16>}n|dkra| |d||f<16>}n7|dks<>d|jd<00>kr<>| ||<00>}ndS||_ d|j||||f}|r<>|d|7}n|r<>|d|7}n| r|d| 7}n|r|d||f7}nd|S(Ntrealmtnoncetqopt algorithmtopaquetMD5sMD5-SESScSs4t|t<00>r!|jd<00>}ntj|<00>j<00>S(Nsutf-8(t
isinstanceRRthashlibtmd5t hexdigest(tx((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pytmd5_utf8PstSHAcSs4t|t<00>r!|jd<00>}ntj|<00>j<00>S(Nsutf-8(R&RRR'tsha1R)(R*((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pytsha_utf8Vscs<00>d||f<16>S(Ns%s:%s((tstd(t hash_utf8(sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt<lambda>\st?s%s:%s:%ss%s:%sis%08xsutf-8iis%s:%s:%s:%s:%stautht,s>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"s , opaque="%s"s, algorithm="%s"s , digest="%s"s , qop="auth", nc=%s, cnonce="%s"s Digest %s(RtgetRtupperRtpathtqueryR R
RRRRttimetctimetosturandomR'R-R)tsplit(RtmethodturlR R!R"R#R$t
_algorithmR+R.tKDtentdigtp_parsedR8tA1tA2tHA1tHA2tncvalueR/tcnoncetnoncebittrespdigtbase((R1sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pytbuild_digest_headerBsn                    ! cKsk|jd k r(|jjj|j<00>nt|dd<00>}|jjdd<00>}d|j<00>krW|dkrWt |d|d<17>t
j ddt
j <00>}t |jd|d d<00><01>|_|j|jj<00>|jj<00>}t|j|j|j<00>|j|j<00>|j|j|j<00>|jd
<|jj||<00>}|jj|<00>||_|St |dd<00>|S( s:Takes the given response and tries digest-auth, if needed.t num_401_callsiswww-authenticateRtdigestisdigest tflagstcountRN(RRtrequesttbodytseektgetattrRR6tlowertsetattrtretcompilet
IGNORECASERtsubRtcontenttrawt release_conntcopyRt_cookiestprepare_cookiesRNR?R@t
connectiontsendthistorytappend(RRtkwargsROts_authtpattprept_r((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt
handle_401<30>s*!  cCsl|jr+|j|j|j<00>|jd<ny|jj<00>|_Wntk
rTnX|j d|j
<00>|S(NRtresponse( RRNR?R@RRTttellRtAttributeErrort register_hookRl(RR((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR<00>s " (RRRRRNRlR(((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyR8s
  S #(RR<RYR:R'tbase64RtcompatRRtcookiesRtutilsRtCONTENT_TYPE_FORM_URLENCODEDtCONTENT_TYPE_MULTI_PARTR tobjectR RRR(((sOc:\users\lifqian\appdata\local\temp\pip_build_lifqian\requests\requests\auth.pyt<module>s