File: //usr/local/lib/python3.10/dist-packages/requests_toolbelt/auth/__pycache__/guess.cpython-310.pyc
o
���gP � @ sR d Z ddlmZ ddlmZ ddlmZmZ G dd� dej�Z G dd � d e �Z
d
S )z-The module containing the code for GuessAuth.� )�auth)�cookies� )�_digest_auth_compat�http_proxy_digestc @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
� GuessAuthz7Guesses the auth type by the WWW-Authentication header.c C s || _ || _d | _d | _d S �N)�username�passwordr �pos)�selfr r
� r
�G/usr/local/lib/python3.10/dist-packages/requests_toolbelt/auth/guess.py�__init__ s
zGuessAuth.__init__c C s� | j d ur
|jj�| j � |j |j�� |j�� }t|d�s$t �
� |_t �|j|j|j� |�
|j� t�| j| j�| _| �|�}|jj|fi |��}|j�|� ||_|S �N�_cookies)r �request�body�seek�content�raw�release_conn�copy�hasattrr �RequestsCookieJarr �extract_cookies_to_jar�prepare_cookiesr �
HTTPBasicAuthr r
�
connection�send�history�append�r �r�kwargs�prep�_rr
r
r �_handle_basic_auth_401 s
z GuessAuth._handle_basic_auth_401c C sh t �| j| j�| _z| j�� W n ty Y nw t| jd�r*| jjd u r*d| j_| jj |fi |��S )N�
num_401_callsr )
�auth_compat�HTTPDigestAuthr r
r �init_per_thread_state�AttributeErrorr r( �
handle_401�r r# r$ r
r
r �_handle_digest_auth_401'