← Back
Editing: guess.cpython-38.pyc
U �ˀXP � @ 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 �>/usr/lib/python3/dist-packages/requests_toolbelt/auth/guess.py�__init__ s zGuessAuth.__init__c C s� | j d k r|jj�| j � |j |j�� |j�� }t|d�sHt � � |_t �|j|j|j� |� |j� t�| j| j�| _| �|�}|jj|f|�}|j�|� ||_|S �N�_cookies)r �request�body�seek�content�raw�release_conn�copy�hasattrr �RequestsCookieJarr �extract_cookies_to_jar�prepare_cookiesr Z HTTPBasicAuthr r � connection�send�history�append�r �r�kwargsZprepZ_rr r r �_handle_basic_auth_401 s z GuessAuth._handle_basic_auth_401c C sf t �| j| j�| _z| j�� W n tk r4 Y nX t| jd�rV| jjd krVd| j_| jj |f|�S )N� num_401_callsr ) �auth_compatZHTTPDigestAuthr r r �init_per_thread_state�AttributeErrorr r% � handle_401�r r"