Ë
    ±Œjz  ã                   óV   — d Z ddlZddlmZmZ ddlmZ  G d„ dej                  «      Z	y)z*The module containing HTTPProxyDigestAuth.é    N)ÚcookiesÚutilsé   )Ú_digest_auth_compatc                   ó¨   ‡ — e Zd ZdZ ej
                  dej                  ¬«      Zˆ fd„Ze	d„ «       Z
e
j                  d„ «       Z
ˆ fd„Zd„ Zd	„ Zˆ xZS )
ÚHTTPProxyDigestAuthaO  HTTP digest authentication between proxy

    :param stale_rejects: The number of rejects indicate that:
        the client may wish to simply retry the request
        with a new encrypted response, without reprompting the user for a
        new username and password. i.e., retry build_digest_header
    :type stale_rejects: int
    zdigest )Úflagsc                 óZ   •— t        t        | �
  |i |¤Ž d| _        | j	                  «        y )Nr   )Úsuperr   Ú__init__Ústale_rejectsÚinit_per_thread_state)ÚselfÚargsÚkwargsÚ	__class__s      €úr/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/requests_toolbelt/auth/http_proxy_digest.pyr   zHTTPProxyDigestAuth.__init__   s,   ø€ ÜÔ! 4Ñ1°4ÐB¸6ÒBØˆÔà×"Ñ"Õ$ó    c                 óP   — t        | dd «      }|€| j                  S |j                  S ©NÚ_thread_local©ÚgetattrÚ_stale_rejectsr   )r   Úthread_locals     r   r   z!HTTPProxyDigestAuth.stale_rejects   s.   € ä˜t _°dÓ;ˆØÐØ×&Ñ&Ð&Ø×)Ñ)Ð)r   c                 ó@   — t        | dd «      }|€|| _        y ||_        y r   r   )r   Úvaluer   s      r   r   z!HTTPProxyDigestAuth.stale_rejects"   s&   € ä˜t _°dÓ;ˆØÐØ"'ˆDÕà).ˆLÕ&r   c                 óJ   •— 	 t         t        | �  «        y # t        $ r Y y w xY w)N)r   r   r   ÚAttributeError)r   r   s    €r   r   z)HTTPProxyDigestAuth.init_per_thread_state*   s(   ø€ ð	ÜÔ% tÑBÕDøÜò 	áð	ús   ƒ –	"¡"c                 ó>  — |j                   dk(  �r| j                  dk  �rü|j                  j                  d«      }|€t	        d«      ‚| j
                  j                  |«      s|S t        j                  | j
                  j                  d|d¬«      «      | _
        d|j                  j                  v rod	| j                  v ra| j                  d	   j                  «       d
k(  r| xj                  dz  c_        n+| j                  d	   j                  «       dk(  rt	        d«      ‚|j                   |j                  «        |j                  j                  «       }t!        j"                  |j$                  |j                  |j&                  «       |j)                  |j$                  «       | j+                  |j,                  |j.                  «      |j                  d<    |j0                  j2                  |fi |¤Ž}|j4                  j7                  |«       ||_        |S |S )z’Handle HTTP 407 only once, otherwise give up

        :param r: current response
        :returns: responses, along with the new response
        i—  é   zproxy-authenticatezRproxy server violated RFC 7235:407 response MUST contain header proxy-authenticateÚ r   )ÚcountúProxy-AuthorizationÚstaleÚtrueÚfalsezUser or password is invalid)Ústatus_coder   ÚheadersÚgetÚIOErrorÚ_patÚmatchr   Úparse_dict_headerÚsubÚchalÚrequestÚlowerÚcontentÚcloseÚcopyr   Úextract_cookies_to_jarÚ_cookiesÚrawÚprepare_cookiesÚbuild_digest_headerÚmethodÚurlÚ
connectionÚsendÚhistoryÚappend)r   Úrr   Ús_authÚprepÚ_rs         r   Ú
handle_407zHTTPProxyDigestAuth.handle_4071   s±  € ð �=‰=˜CÓ D×$6Ñ$6¸Ó$:Ø—Y‘Y—]‘]Ð#7Ó8ˆFØˆ~ÜðJóKð Kð —Y‘Y—_‘_ VÔ,Ø�ä×/Ñ/Ø—	‘	—‘˜b &°�Ó2ó4ˆDŒIð
 &¨¯©×):Ñ):Ñ:Ø˜tŸy™yÑ(Ø—9‘9˜WÑ%×+Ñ+Ó-°Ò7Ø×&Ò&¨!Ñ+Ö&à—Y‘Y˜wÑ'×-Ñ-Ó/°7Ò:Ü!Ð"?Ó@Ð@ð �IŠIØ�G‰GŒIØ—9‘9—>‘>Ó#ˆDÜ×*Ñ*¨4¯=©=¸!¿)¹)ÀQÇUÁUÔKØ× Ñ  §¡Ô/à26×2JÑ2JØ—‘˜TŸX™Xó3'ˆD�L‰LÐ.Ñ/à"�—‘×"Ñ" 4Ñ2¨6Ñ2ˆBØ�J‰J×Ñ˜aÔ ØˆBŒJàˆIàˆHr   c                 óÜ   — | j                  «        | j                  r3| j                  |j                  |j                  «      |j
                  d<   |j                  d| j                  «       |S )Nr$   Úresponse)r   Ú
last_noncer:   r;   r<   r)   Úregister_hookrE   )r   rA   s     r   Ú__call__zHTTPProxyDigestAuth.__call___   sU   € Ø×"Ñ"Ô$à�?Š?Ø/3×/GÑ/GØ—‘˜!Ÿ%™%ó0ˆA�I‰IÐ+Ñ,ð 	
�‰˜
 D§O¡OÔ4Øˆr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚreÚcompileÚ
IGNORECASEr,   r   Úpropertyr   Úsetterr   rE   rJ   Ú__classcell__)r   s   @r   r   r   
   sc   ø„ ñð ˆ2�:‰:�j¨¯©Ô6€Dô%ð ñ*ó ð*ð ×Ññ/ó ð/ôò,ö\r   r   )
rN   rO   Úrequestsr   r   r"   r   ÚauthÚHTTPDigestAuthr   © r   r   Ú<module>rY      s%   ðá 0Û 	ç #å )ô]˜$×-Ñ-õ ]r   