Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/requests/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/requests/__pycache__/auth.cpython-311.pyc

�

�܋f�'���dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZd	Zd
Zd�ZGd�d
��ZGd�de��ZGd�de��ZGd�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-datac	��t|t��s=tjd�|��t
���t
|��}t|t��sJtjd�t|����t
���t
|��}t|t��r|�d��}t|t��r|�d��}dttd�||f���������z}|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�authstrs   �D/opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/auth.py�_basic_auth_strrs6���h�
�+�+�!��
�
���x�(�(�'�	
�	
�	
�	
��x�=�=���h�
�+�+�!��
�
���t�H�~�~�.�.�'�	
�	
�	
�	
��x�=�=���(�C� � �-��?�?�8�,�,���(�C� � �-��?�?�8�,�,���)��$�)�)�X�x�0�1�1�2�2�8�8�:�:����G��N�c��eZdZdZd�ZdS)�AuthBasez4Base class that all auth implementations derive fromc� �td���)NzAuth hooks must be callable.)�NotImplementedError��self�rs  r�__call__zAuthBase.__call__Hs��!�"@�A�A�ArN��__name__�
__module__�__qualname__�__doc__r%�rrrrEs.������>�>�B�B�B�B�Brrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.c�"�||_||_dS�N)rr�r#rrs   r�__init__zHTTPBasicAuth.__init__Os�� ��
� ��
�
�
rc	��t|jt|dd��k|jt|dd��kg��S�Nrr��allr�getattrr�r#�others  r�__eq__zHTTPBasicAuth.__eq__S�E����
���
�D�!A�!A�A��
���
�D�!A�!A�A�
�
�
�	
rc��||kSr/r+r7s  r�__ne__zHTTPBasicAuth.__ne__[����5�=� � rc�J�t|j|j��|jd<|S)N�
Authorization�rrr�headersr"s  rr%zHTTPBasicAuth.__call__^s!��%4�T�]�D�M�%R�%R��	�/�"��rN)r'r(r)r*r1r9r<r%r+rrr-r-LsV������I�I�!�!�!�
�
�
�!�!�!�����rr-c��eZdZdZd�ZdS)�
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.c�J�t|j|j��|jd<|S)NzProxy-Authorizationr@r"s  rr%zHTTPProxyAuth.__call__fs"��+:�4�=�$�-�+X�+X��	�'�(��rNr&r+rrrCrCcs)������G�G�����rrCc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.c�R�||_||_tj��|_dSr/)rr�	threading�local�
_thread_localr0s   rr1zHTTPDigestAuth.__init__ns&�� ��
� ��
�&�_�.�.����rc���t|jd��sJd|j_d|j_d|j_i|j_d|j_d|j_dSdS)N�initT�r)�hasattrrJrL�
last_nonce�nonce_count�chal�pos�
num_401_calls)r#s r�init_per_thread_statez$HTTPDigestAuth.init_per_thread_statetsi���t�)�6�2�2�	4�&*�D��#�,.�D��)�-.�D��*�&(�D��#�%)�D��"�/3�D��,�,�,�
	4�	4rc����|jjd}|jjd}|jj�d��}|jj�d��}|jj�d��}d�|�d}n|���}|dks|dkrd	�}	|	�n#|d
krd�}
|
�n|dkrd
�}|�n|dkrd�}|��fd�}
��dSd}t	|��}|jpd}|jr
|d|j��z
}|j�d|�d|j��}|�d|��}�|��}�|��}||jj	kr|jxj
dz
c_
nd|j_
|jj
d�}t|jj
���d��}||�d��z
}|tj���d��z
}|tjd��z
}t#j|�����dd�}|dkr�|�d|�d|����}|s|
||�d|����}n9|dksd|�d��vr|�d|�d|�d|��}|
||��}ndS||j_	d|j�d|�d|�d|�d |�d!�}|r	|d"|�d!�z
}|r	|d#|�d!�z
}|r	|d$|�d!�z
}|r|d%|�d&|�d!�z
}d'|��S)(z
        :rtype: str
        �realm�nonce�qop�	algorithm�opaqueN�MD5zMD5-SESSc��t|t��r|�d��}tj|�����S�N�utf-8)rrr�hashlib�md5�	hexdigest��xs r�md5_utf8z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8�s?���a��%�%�*�����)�)�A��{�1�~�~�/�/�1�1�1r�SHAc��t|t��r|�d��}tj|�����Sr])rrrr_�sha1rarbs r�sha_utf8z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8�s?���a��%�%�*�����)�)�A��|�A���0�0�2�2�2rzSHA-256c��t|t��r|�d��}tj|�����Sr])rrrr_�sha256rarbs r�sha256_utf8z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8��A���a��%�%�*�����)�)�A��~�a�(�(�2�2�4�4�4rzSHA-512c��t|t��r|�d��}tj|�����Sr])rrrr_�sha512rarbs r�sha512_utf8z7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8�rlrc�$���|�d|����S)N�:r+)�s�d�	hash_utf8s  �r�<lambda>z4HTTPDigestAuth.build_digest_header.<locals>.<lambda>�s���)�)�q�J�J�1�J�J�/�/�r�/�?rqr�08xr^���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 )rJrQ�get�upperr�path�queryrrrOrPrr�time�ctime�os�urandomr_rgra�split)r#�method�urlrVrWrXrYrZ�
_algorithmrdrhrkro�KD�entdig�p_parsedr��A1�A2�HA1�HA2�ncvaluerr�cnonce�respdig�noncebit�baserts                           @r�build_digest_headerz"HTTPDigestAuth.build_digest_header~s5���
�"�'��0���"�'��0��� �%�)�)�%�0�0���&�+�/�/��<�<�	��#�(�,�,�X�6�6���	����J�J�"���*�*�J�����*�
�":�":�
2�
2�
2�
!�I�I�
�5�
 �
 �
3�
3�
3�
!�I�I�
�9�
$�
$�
5�
5�
5�
$�I�I�
�9�
$�
$�
5�
5�
5�
$�I�
/�
/�
/�
/�����4����C�=�=���}�#����>�	)��(���(�(�(�D��
�
7�
7��
7�
7��
�
7�
7���
�
��
�
���i��m�m���i��m�m���D�&�1�1�1���*�*�a�/�*�*�*�-.�D��*��'�3�9�9����"�.�/�/�6�6�w�?�?��	�U�\�\�'�
"�
"�"��	�T�Z�\�\�
 �
 ��
)�
)�)��	�R�Z��]�]�����a���*�*�,�,�S�b�S�1����#�#��)�s�5�5�U�5�5�V�5�5�6�6�C��	��b���.�.��.�.�/�/�G�G�
�F�]�]�f��	�	�#���6�6��?�?�'�?�?�F�?�?�#�?�?�H��b��h�'�'�G�G��4�(-���%�
2���
2�
2�%�
2�
2�5�
2�
2��
2�
2�'.�
2�
2�
2�	
��	+��*��*�*�*�*�D��	1��0�I�0�0�0�0�D��	+��*��*�*�*�*�D��	E��D��D�D�6�D�D�D�D�D�����rc�0�|jrd|j_dSdS)z)Reset num_401_calls counter on redirects.rN)�is_redirectrJrS)r#r$�kwargss   r�handle_redirectzHTTPDigestAuth.handle_redirect�s'���=�	1�/0�D��,�,�,�	1�	1rc��d|jcxkrdksnd|j_|S|jj�)|jj�|jj��|j�dd��}d|�	��v�rA|jjdk�r0|jxjdz
c_tjd	tj�
��}t|�d|d�����|j_|j|���|j���}t'|j|j|j��|�|j��|�|j|j��|jd<|jj|fi|��}|j�|��||_|Sd|j_|S)
zo
        Takes the given response and tries digest-auth, if needed.

        :rtype: requests.Response
        i�i�rNzwww-authenticaterM�digest�zdigest )�flags)�countr?)�status_coderJrSrR�request�body�seekrAr~�lower�re�compile�
IGNORECASEr
�subrQ�content�close�copyr	�_cookies�raw�prepare_cookiesr�r�r��
connection�send�history�append)r#r$r��s_auth�pat�prep�_rs       r�
handle_401zHTTPDigestAuth.handle_401�s����a�m�)�)�)�)�c�)�)�)�)�/0�D��,��H���!�-�
�I�N���� 2� 6�7�7�7�����1�2�6�6���v�|�|�~�~�%�%�$�*<�*J�Q�*N�*N���,�,��1�,�,��*�Z�r�}�=�=�=�C�&7�����F�RS��8T�8T�&U�&U�D��#�
�I�I�
�G�G�I�I�I��9�>�>�#�#�D�"�4�=�!�)�Q�U�C�C�C�� � ���/�/�/�,0�,D�,D���T�X�-�-�D�L��)�#���"�4�2�2�6�2�2�B��J���a� � � ��B�J��I�+,���(��rc��|���|jjr(|�|j|j��|jd<	|j���|j_	n#t$rd|j_	YnwxYw|�d|j��|�d|j
��d|j_|S)Nr?�responser)rTrJrOr�r�r�rAr��tellrR�AttributeError�
register_hookr�r�rSr"s  rr%zHTTPDigestAuth.__call__s����"�"�$�$�$���(�	S�)-�)A�)A�!�(�A�E�)R�)R�A�I�o�&�	*�%&�V�[�[�]�]�D��"�"���	*�	*�	*�
&*�D��"�"�"�	*����	
���
�D�O�4�4�4�	���
�D�$8�9�9�9�+,���(��s�
#A.�.B�Bc	��t|jt|dd��k|jt|dd��kg��Sr3r4r7s  rr9zHTTPDigestAuth.__eq__2r:rc��||kSr/r+r7s  rr<zHTTPDigestAuth.__ne__:r=rN)r'r(r)r*r1rTr�r�r�r%r9r<r+rrrFrFks�������J�J�/�/�/�4�4�4�l �l �l �\1�1�1�
+�+�+�Z���(
�
�
�!�!�!�!�!rrF)r*r_r�r�rHr�r�base64r�_internal_utilsr�compatrrr�cookiesr	�utilsr
�CONTENT_TYPE_FORM_URLENCODED�CONTENT_TYPE_MULTI_PARTrrr-rCrFr+rr�<module>r�s���������	�	�	�	�	�	�	�	�������������������-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�+�+�+�+�+�$�$�$�$�$�$�B��/��)�)�)�XB�B�B�B�B�B�B�B������H����.�����M����P!�P!�P!�P!�P!�X�P!�P!�P!�P!�P!r

Hacked By AnonymousFox1.0, Coded By AnonymousFox