HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/requests/__pycache__/auth.cpython-37.pyc
B

���g�'�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZd	Zd
Zdd�ZGd
d�d�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z]
requests.auth
~~~~~~~~~~~~~

This module contains the authentication handlers for Requests.
�N)�	b64encode�)�to_native_string)�
basestring�str�urlparse)�extract_cookies_to_jar)�parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCs�t|t�s&tjd�|�td�t|�}t|t�sPtjd�t|��td�t|�}t|t�rd|�d�}t|t�rx|�d�}dt	t
d�||f�����}|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.)�categoryz�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.�latin1zBasic �:)
�
isinstancer�warnings�warn�format�DeprecationWarningr�type�encoderr�join�strip)�username�password�authstr�r�7/usr/local/lib/python3.7/site-packages/requests/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__HszAuthBase.__call__N)�__name__�
__module__�__qualname__�__doc__r rrrrrEsrc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS)N)rr)rrrrrr�__init__OszHTTPBasicAuth.__init__cCs(t|jt|dd�k|jt|dd�kg�S)Nrr)�allr�getattrr)r�otherrrr�__eq__SszHTTPBasicAuth.__eq__cCs
||kS)Nr)rr)rrr�__ne__[szHTTPBasicAuth.__ne__cCst|j|j�|jd<|S)N�
Authorization)rrr�headers)rrrrrr ^szHTTPBasicAuth.__call__N)r!r"r#r$r&r*r+r rrrrr%Ls
r%c@seZdZdZdd�ZdS)�
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCst|j|j�|jd<|S)NzProxy-Authorization)rrrr-)rrrrrr fszHTTPProxyAuth.__call__N)r!r"r#r$r rrrrr.csr.c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_t��|_dS)N)rr�	threading�local�
_thread_local)rrrrrrr&nszHTTPDigestAuth.__init__cCs@t|jd�s<d|j_d|j_d|j_i|j_d|j_d|j_dS)N�initT�r)�hasattrr2r3�
last_nonce�nonce_count�chal�pos�
num_401_calls)rrrr�init_per_thread_statetsz$HTTPDigestAuth.init_per_thread_statecs�|jjd}|jjd}|jj�d�}|jj�d�}|jj�d�}d�|dkrTd}n|��}|dksl|dkrzd	d
�}	|	�n@|dkr�dd
�}
|
�n*|dkr�dd�}|�n|dkr�dd�}|��fdd�}
�dkr�dSd}t|�}|jp�d}|jr�|d|j��7}|j�d|�d|j��}|�d|��}�|�}�|�}||jj	k�rT|jj
d7_
nd|j_
|jj
d�}t|jj
��d�}||�d�7}|t
���d�7}|t�d�7}t�|���dd�}|dk�r�|�d|�d|���}|�s�|
||�d|���}nD|dk�sd|�d�k�r<|�d|�d|�d |��}|
||�}ndS||j_	d!|j�d"|�d#|�d$|�d%|�d&�}|�r�|d'|�d&�7}|�r�|d(|�d&�7}|�r�|d)|�d&�7}|�r�|d*|�d+|�d&�7}d,|��S)-z
        :rtype: str
        �realm�nonce�qop�	algorithm�opaqueN�MD5zMD5-SESScSs"t|t�r|�d�}t�|���S)Nzutf-8)r
rr�hashlib�md5�	hexdigest)�xrrr�md5_utf8�s

z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8�SHAcSs"t|t�r|�d�}t�|���S)Nzutf-8)r
rrrB�sha1rD)rErrr�sha_utf8�s

z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8zSHA-256cSs"t|t�r|�d�}t�|���S)Nzutf-8)r
rrrB�sha256rD)rErrr�sha256_utf8�s

z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8zSHA-512cSs"t|t�r|�d�}t�|���S)Nzutf-8)r
rrrB�sha512rD)rErrr�sha512_utf8�s

z7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8cs�|�d|���S)N�:r)�s�d)�	hash_utf8rr�<lambda>��z4HTTPDigestAuth.build_digest_header.<locals>.<lambda>�/�?rNr�08xzutf-8���auth�,z:auth:z
username="z
", realm="z
", nonce="z", uri="z
", response="�"z
, opaque="z
, algorithm="z
, digest="z, qop="auth", nc=z
, cnonce="zDigest )r2r8�get�upperr�path�queryrrr6r7rr�time�ctime�os�urandomrBrHrD�split)r�method�urlr<r=r>r?r@�
_algorithmrFrIrKrM�KD�entdig�p_parsedr^�A1�A2�HA1�HA2�ncvaluerO�cnonce�respdig�noncebit�baser)rQr�build_digest_header~sz

&z"HTTPDigestAuth.build_digest_headercKs|jrd|j_dS)z)Reset num_401_calls counter on redirects.rN)�is_redirectr2r:)rr�kwargsrrr�handle_redirect�szHTTPDigestAuth.handle_redirectcKs"d|jkrdks$nd|j_|S|jjdk	rB|jj�|jj�|j�dd�}d|�	�k�r|jjdk�r|jjd7_t
jd	t
jd
�}t
|jd|dd��|j_|j|��|j��}t|j|j|j�|�|j�|�|j|j�|jd<|jj|f|�}|j�|�||_|Sd|j_|S)
zo
        Takes the given response and tries digest-auth, if needed.

        :rtype: requests.Response
        i�i�rNzwww-authenticater4�digest�zdigest )�flags)�countr,)�status_coder2r:r9�request�body�seekr-r\�lower�re�compile�
IGNORECASEr	�subr8�content�close�copyr�_cookies�raw�prepare_cookiesrtrerf�
connection�send�history�append)rrrv�s_auth�pat�prep�_rrrr�
handle_401�s.	
zHTTPDigestAuth.handle_401cCs~|��|jjr&|�|j|j�|jd<y|j��|j_	Wnt
k
rTd|j_	YnX|�d|j�|�d|j
�d|j_|S)Nr,�responser)r;r2r6rtrerfr-r~�tellr9�AttributeError�
register_hookr�rwr:)rrrrrr szHTTPDigestAuth.__call__cCs(t|jt|dd�k|jt|dd�kg�S)Nrr)r'rr(r)rr)rrrr*2szHTTPDigestAuth.__eq__cCs
||kS)Nr)rr)rrrr+:szHTTPDigestAuth.__ne__N)r!r"r#r$r&r;rtrwr�r r*r+rrrrr/ks
n-r/)r$rBrbr�r0r`r�base64r�_internal_utilsr�compatrrr�cookiesr�utilsr	�CONTENT_TYPE_FORM_URLENCODED�CONTENT_TYPE_MULTI_PARTrrr%r.r/rrrr�<module>s$,