Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ÝPf&ã@sÌdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZddlmZddlmZd Zd Zd d „ZGd d„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdS)z] requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. éN)Ú b64encodeé)ÚurlparseÚstrÚ basestring)Úextract_cookies_to_jar)Úto_native_string)Úparse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCs–t|tƒs&tjdj|ƒtd�t|ƒ}t|tƒsLtjdj|ƒtd�t|ƒ}t|tƒr`|jdƒ}t|tƒrt|jdƒ}dtt dj ||fƒƒj ƒƒ}|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 ({0!r}) to a string or bytes object in the near future to avoid problems.)Úcategoryz¸Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({0!r}) to a string or bytes object in the near future to avoid problems.Úlatin1zBasic ó:) Ú isinstancerÚwarningsÚwarnÚformatÚDeprecationWarningrÚencoderrÚjoinÚstrip)ÚusernameÚpasswordZauthstr©rú/usr/lib/python3.6/auth.pyÚ_basic_auth_strs&      rc@seZdZdZdd„ZdS)ÚAuthBasez4Base class that all auth implementations derive fromcCs tdƒ‚dS)NzAuth hooks must be callable.)ÚNotImplementedError)ÚselfÚrrrrÚ__call__KszAuthBase.__call__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrrrrHsrc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS)N)rr)rrrrrrÚ__init__RszHTTPBasicAuth.__init__cCs(t|jt|ddƒk|jt|ddƒkgƒS)Nrr)ÚallrÚgetattrr)rÚotherrrrÚ__eq__VszHTTPBasicAuth.__eq__cCs ||k S)Nr)rr'rrrÚ__ne__\szHTTPBasicAuth.__ne__cCst|j|jƒ|jd<|S)NÚ Authorization)rrrÚheaders)rrrrrr_szHTTPBasicAuth.__call__N)rr r!r"r$r(r)rrrrrr#Os r#c@seZdZdZdd„ZdS)Ú HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|jƒ|jd<|S)NzProxy-Authorization)rrrr+)rrrrrrgszHTTPProxyAuth.__call__N)rr r!r"rrrrrr,dsr,c@sPeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dS)ÚHTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_tjƒ|_dS)N)rrÚ threadingZlocalÚ _thread_local)rrrrrrr$oszHTTPDigestAuth.__init__cCs@t|jdƒs.md5_utf8ZSHAcSs"t|tƒr|jdƒ}tj|ƒjƒS)Nzutf-8)r rrr>Úsha1r?)r@rrrÚsha_utf8—s  z4HTTPDigestAuth.build_digest_header..sha_utf8csˆd||fƒS)Nz%s:%sr)ÚsÚd)Ú hash_utf8rrÚ�sz4HTTPDigestAuth.build_digest_header..ú/ú?z%s:%s:%sz%s:%srz%08xzutf-8ééZauthú,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)r/r5ÚgetÚupperrÚpathZqueryrrr3r4rrÚtimeZctimeÚosÚurandomr>rBr?Úsplit)rÚmethodÚurlr9r:r;r<r=Z _algorithmrArCZKDZentdigZp_parsedrOZA1ZA2ZHA1ZHA2ZncvaluerDZcnonceZrespdigZnoncebitÚbaser)rFrÚbuild_digest_headersr           z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)Z is_redirectr/r7)rrÚkwargsrrrÚhandle_redirectÙszHTTPDigestAuth.handle_redirectcKs"d|jkodkns&d|j_|S|jjdk rD|jjj|jjƒ|jjddƒ}d|j ƒkoh|jjdk�r|jjd7_t j d t j d �}t |jd|dd �ƒ|j_|j|jƒ|jjƒ}t|j|j|jƒ|j|jƒ|j|j|jƒ|jd <|jj|f|Ž}|jj|ƒ||_|Sd|j_|S) zo Takes the given response and tries digest-auth, if needed. :rtype: requests.Response i�iôrNzwww-authenticater1Zdigestézdigest )Úflags)Úcountr*)Z status_coder/r7r6ZrequestÚbodyÚseekr+rMÚlowerÚreÚcompileÚ IGNORECASEr Úsubr5ZcontentÚcloseÚcopyrZ_cookiesÚrawZprepare_cookiesrWrTrUZ connectionÚsendÚhistoryÚappend)rrrXZs_authZpatZprepZ_rrrrÚ handle_401Þs.     zHTTPDigestAuth.handle_401c Cs~|jƒ|jjr&|j|j|jƒ|jd<y|jjƒ|j_ Wnt k rTd|j_ YnX|j d|j ƒ|j d|j ƒd|j_|S)Nr*Zresponser)r8r/r3rWrTrUr+r]Útellr6ÚAttributeErrorZ register_hookrjrYr7)rrrrrr szHTTPDigestAuth.__call__cCs(t|jt|ddƒk|jt|ddƒkgƒS)Nrr)r%rr&r)rr'rrrr(szHTTPDigestAuth.__eq__cCs ||k S)Nr)rr'rrrr)$szHTTPDigestAuth.__ne__N) rr r!r"r$r8rWrYrjrr(r)rrrrr-ls Z,r-)r"rQr`rPr>r.rÚbase64rÚcompatrrrZcookiesrZ_internal_utilsrZutilsr ZCONTENT_TYPE_FORM_URLENCODEDZCONTENT_TYPE_MULTI_PARTrÚobjectrr#r,r-rrrrÚs$    ,