%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/requests/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/requests/__pycache__/auth.cpython-312.pyc

�

�kd�'����dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZd	Zd
Zd�ZGd�d
�ZGd�de�ZGd�de�ZGd�de�Zy)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�s5tjdj	|�t
��t
|�}t|t�s>tjdj	t|��t
��t
|�}t|t�r|jd�}t|t�r|jd�}dttdj||f��j��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   �//usr/lib/python3/dist-packages/requests/auth.py�_basic_auth_strrs����h�
�+��
�
�
���x�(�'�	
��x�=���h�
�+��
�
�
���t�H�~�.�'�	
��x�=���(�C� ��?�?�8�,���(�C� ��?�?�8�,���)��$�)�)�X�x�0�1�2�8�8�:���G��N�c��eZdZdZd�Zy)�AuthBasez4Base class that all auth implementations derive fromc��td��)NzAuth hooks must be callable.)�NotImplementedError��self�rs  r�__call__zAuthBase.__call__Hs��!�"@�A�ArN��__name__�
__module__�__qualname__�__doc__r%�rrrrEs��>�Brrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.c� �||_||_y�N)rr�r#rrs   r�__init__zHTTPBasicAuth.__init__Os�� ��
� ��
rc	�|�t|jt|dd�k(|jt|dd�k(g�S�Nrr��allr�getattrr�r#�others  r�__eq__zHTTPBasicAuth.__eq__S�>����
�
���
�D�!A�A��
�
���
�D�!A�A�
�
�	
rc��||k(Sr/r+r7s  r�__ne__zHTTPBasicAuth.__ne__[����5�=� � rc�`�t|j|j�|jd<|S)N�
Authorization�rrr�headersr"s  rr%zHTTPBasicAuth.__call__^s$��%4�T�]�]�D�M�M�%R��	�	�/�"��rN)r'r(r)r*r1r9r<r%r+rrr-r-Ls��I�!�
�!�rr-c��eZdZdZd�Zy)�
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.c�`�t|j|j�|jd<|S)NzProxy-Authorizationr@r"s  rr%zHTTPProxyAuth.__call__fs%��+:�4�=�=�$�-�-�+X��	�	�'�(��rNr&r+rrrCrCcs
��G�rrCc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.c�R�||_||_tj�|_yr/)rr�	threading�local�
_thread_localr0s   rr1zHTTPDigestAuth.__init__ns�� ��
� ��
�&�_�_�.��rc��t|jd�sgd|j_d|j_d|j_i|j_d|j_d|j_yy)N�initT�r)�hasattrrJrL�
last_nonce�nonce_count�chal�pos�
num_401_calls)r#s r�init_per_thread_statez$HTTPDigestAuth.init_per_thread_statetsk���t�)�)�6�2�&*�D���#�,.�D���)�-.�D���*�&(�D���#�%)�D���"�/3�D���,�
3rc�B��|jjd}|jjd}|jjjd�}|jjjd�}|jjjd�}d�|�d}n|j�}|dk(s|dk(rd	�}	|	�n |d
k(rd�}
|
�n|dk(rd
�}|�n
|dk(rd�}|��fd�}
��yd}t	|�}|j
xsd}|jr|d|j��z
}|j�d|�d|j��}|�d|��}�|�}�|�}||jjk(r |jxjdz
c_
nd|j_
|jjd�}t|jj�jd�}||jd�z
}|tj�jd�z
}|tj d�z
}t#j$|�j'�dd}|dk(r�|�d|�d|���}|s|
||�d|���}n0|dk(sd|j)d�vr|�d|�d|�d|��}|
||�}ny||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|jd�}tj|�j�S�N�utf-8)rrr�hashlib�md5�	hexdigest��xs r�md5_utf8z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8�s1���a��%�����)�A��{�{�1�~�/�/�1�1r�SHAc��t|t�r|jd�}tj|�j�Sr])rrrr_�sha1rarbs r�sha_utf8z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8�s1���a��%�����)�A��|�|�A��0�0�2�2rzSHA-256c��t|t�r|jd�}tj|�j�Sr])rrrr_�sha256rarbs r�sha256_utf8z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8��2���a��%�����)�A��~�~�a�(�2�2�4�4rzSHA-512c��t|t�r|jd�}tj|�j�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�c��1�#�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~s����
�"�"�'�'��0���"�"�'�'��0��� � �%�%�)�)�%�0���&�&�+�+�/�/��<�	��#�#�(�(�,�,�X�6���	����J�"���*�J����*�
�":�
2�
!�I�
�5�
 �
3�
!�I�
�9�
$�
5�
$�I�
�9�
$�
5�
$�I�
/��������C�=���}�}�#����>�>��a����'�(�(�D��
�
��a��w�a��
�
��
7���x�q���
����m����m���D�&�&�1�1�1����*�*�a�/�*�-.�D���*��'�'�3�3�C�8����"�"�.�.�/�6�6�w�?��	�U�\�\�'�
"�"��	�T�Z�Z�\�
 �
 ��
)�)��	�R�Z�Z��]������a��*�*�,�S�b�1����#��s�e�1�U�G�1�V�H�5�6�C������q���.�/�G�
�F�]�f��	�	�#��6����'��!�F�8�6�#��?�H���h�'�G��(-����%������z�%��
�5�'�J��6��w�i�q�
2�	
���j����*�*�D���m�I�;�a�0�0�D���j����*�*�D���'��y�
�6�(�!�D�D�D�����rc�@�|jrd|j_yy)z)Reset num_401_calls counter on redirects.rN)�is_redirectrJrS)r#r$�kwargss   r�handle_redirectzHTTPDigestAuth.handle_redirect�s���=�=�/0�D���,�rc�l�d|jcxkrdksnd|j_|S|jj�9|jj
j
|jj�|jjdd�}d|j�v�rz|jjdk�r`|jxjdz
c_tjdtj�	�}t|jd|d�
��|j_|j |j#�|jj%�}t'|j(|j|j*�|j-|j(�|j/|j0|j2�|jd<|j4j6|fi|��}|j8j;|�||_|Sd|j_|S)zo
        Takes the given response and tries digest-auth, if needed.

        :rtype: requests.Response
        i�i�rzwww-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�m�)�c�)�/0�D���,��H����!�!�-�
�I�I�N�N���� 2� 2� 6� 6�7������1�2�6���v�|�|�~�%�$�*<�*<�*J�*J�Q�*N����,�,��1�,��*�*�Z�r�}�}�=�C�&7�����F�RS��8T�&U�D���#�
�I�I�
�G�G�I��9�9�>�>�#�D�"�4�=�=�!�)�)�Q�U�U�C�� � ����/�,0�,D�,D����T�X�X�-�D�L�L��)�#����"�"�4�2�6�2�B��J�J���a� ��B�J��I�+,����(��rc���|j�|jjr3|j|j|j
�|jd<	|jj�|j_	|jd|j�|jd|j�d|j_|S#t$rd|j_	Y�gwxYw)Nr?�responser)rTrJrOr�r�r�rAr��tellrR�AttributeError�
register_hookr�r�rSr"s  rr%zHTTPDigestAuth.__call__s����"�"�$����(�(�)-�)A�)A�!�(�(�A�E�E�)R�A�I�I�o�&�	*�%&�V�V�[�[�]�D���"�	
���
�D�O�O�4�	���
�D�$8�$8�9�+,����(�����	*�
&*�D���"�	*�s�)C�C,�+C,c	�|�t|jt|dd�k(|jt|dd�k(g�Sr3r4r7s  rr9zHTTPDigestAuth.__eq__2r:rc��||k(Sr/r+r7s  rr<zHTTPDigestAuth.__ne__:r=rN)r'r(r)r*r1rTr�r�r�r%r9r<r+rrrFrFks0��J�/�4�l �\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�st����	�	�����-�-�-�+�$�B��/��)�XB�B��H��.�M��P!�X�P!r

Zerion Mini Shell 1.0