+
    i'                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^RI	H
t
 ^RIHtHtHt ^RIHt ^RIHt RtRtR	 t ! R
 R4      t ! R R]4      t ! R R]4      t ! R R]4      tR# )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-urlencodedzmultipart/form-datac           	     V   \        V \        4      '       g7   \        P                  ! RP	                  V 4      \
        R7       \        V 4      p \        V\        4      '       g@   \        P                  ! RP	                  \        V4      4      \
        R7       \        V4      p\        V \        4      '       d   V P                  R4      p \        V\        4      '       d   VP                  R4      pR\        \        RP                  W34      4      P                  4       4      ,           pV# )zReturns a Basic Auth string.zNon-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.)categoryzNon-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.latin1zBasic    :)
isinstancer   warningswarnformatDeprecationWarningr   typeencoder   r   joinstrip)usernamepasswordauthstrs   && S/Users/ahmad/.openclaw/workspace/venv/lib/python3.14/site-packages/requests/auth.py_basic_auth_strr      s     h
++ x('	
 x=h
++ tH~.'	
 x= (C  ??8,(C  ??8,)$))X01288: G N    c                   *   a  ] tR t^Et o RtR tRtV tR# )AuthBasez4Base class that all auth implementations derive fromc                    \        R 4      h)zAuth hooks must be callable.)NotImplementedErrorselfrs   &&r   __call__AuthBase.__call__H   s    !"@AAr    N__name__
__module____qualname____firstlineno____doc__r#   __static_attributes____classdictcell____classdict__s   @r   r   r   E   s     >B Br   r   c                   <   a  ] tR t^Lt o RtR tR tR tR tRt	V t
R# )HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.c                    Wn         W n        R # N)r   r   r!   r   r   s   &&&r   __init__HTTPBasicAuth.__init__O   s      r   c           	     |    \        V P                  \        VR R4      8H  V P                  \        VRR4      8H  .4      # r   Nr   allr   getattrr   r!   others   &&r   __eq__HTTPBasicAuth.__eq__S   >    
D!AA
D!AA
 	
r   c                    W8X  * # r3   r%   r<   s   &&r   __ne__HTTPBasicAuth.__ne__[         r   c                `    \        V P                  V P                  4      VP                  R &   V# )Authorizationr   r   r   headersr    s   &&r   r#   HTTPBasicAuth.__call__^   s$    %4T]]DMM%R		/"r   )r   r   N)r'   r(   r)   r*   r+   r5   r>   rB   r#   r,   r-   r.   s   @r   r1   r1   L   s!     I!
! r   r1   c                   *   a  ] tR t^ct o RtR tRtV tR# )HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.c                `    \        V P                  V P                  4      VP                  R &   V# )zProxy-AuthorizationrG   r    s   &&r   r#   HTTPProxyAuth.__call__f   s%    +:4==$--+X		'(r   r%   Nr&   r.   s   @r   rK   rK   c   s     G r   rK   c                   T   a  ] tR t^kt o RtR tR tR tR tR t	R t
R tR	 tR
tV tR# )HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.c                R    Wn         W n        \        P                  ! 4       V n        R # r3   )r   r   	threadinglocal_thread_localr4   s   &&&r   r5   HTTPDigestAuth.__init__n   s      &__.r   c                   \        V P                  R 4      '       gi   RV P                  n        RV P                  n        ^ V P                  n        / V P                  n        RV P                  n        RV P                  n        R# R# )initT N)hasattrrS   rV   
last_noncenonce_countchalposnum_401_calls)r!   s   &r   init_per_thread_state$HTTPDigestAuth.init_per_thread_statet   sn    t))622&*D#,.D)-.D*&(D#%)D"/3D, 3r   c                ,  a V P                   P                  R,          pV P                   P                  R,          pV P                   P                  P                  R4      pV P                   P                  P                  R4      pV P                   P                  P                  R4      pRoVf   RpMVP                  4       pVR8X  g   VR8X  d   R	 p	V	oM&VR
8X  d   R p
V
oMVR8X  d   R pVoMVR8X  d   R pVoV3R lpSf   R# Rp\	        V4      pVP
                  ;'       g    RpVP                  '       d   VRVP                   2,          pV P                   RV RV P                   2pV RV 2pS! V4      pS! V4      pW@P                   P                  8X  d%   V P                   ;P                  ^,          un
        M^V P                   n
        V P                   P                  R p\        V P                   P                  4      P                  R4      pVVP                  R4      ,          pV\        P                  ! 4       P                  R4      ,          pV\        P                   ! ^4      ,          p\"        P$                  ! V4      P'                  4       R,          pVR8X  d   S! V RV RV 24      pV'       g   V! VV RV 24      pM6VR8X  g   RVP)                  R4      9   d   V RV RV RV 2pV! VV4      pMR# W@P                   n	        RV P                   RV RV RV RV R2pV'       d   VR V R2,          pV'       d   VR!V R2,          pV'       d   VR"V R2,          pV'       d   VR#V R$V R2,          pR%V 2# )&z
:rtype: str
realmnonceqop	algorithmopaqueNMD5zMD5-SESSc                     \        V \        4      '       d   V P                  R 4      p \        P                  ! V 4      P                  4       # utf-8)r   r   r   hashlibmd5	hexdigestxs   &r   md5_utf84HTTPDigestAuth.build_digest_header.<locals>.md5_utf8   s4    a%%)A{{1~//11r   SHAc                     \        V \        4      '       d   V P                  R 4      p \        P                  ! V 4      P                  4       # rh   )r   r   r   rj   sha1rl   rm   s   &r   sha_utf84HTTPDigestAuth.build_digest_header.<locals>.sha_utf8   s4    a%%)A||A0022r   zSHA-256c                     \        V \        4      '       d   V P                  R 4      p \        P                  ! V 4      P                  4       # rh   )r   r   r   rj   sha256rl   rm   s   &r   sha256_utf87HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8   5    a%%)A~~a(2244r   zSHA-512c                     \        V \        4      '       d   V P                  R 4      p \        P                  ! V 4      P                  4       # rh   )r   r   r   rj   sha512rl   rm   s   &r   sha512_utf87HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8   rz   r   c                    < S! V  R V 24      # ):r%   )sd	hash_utf8s   &&r   <lambda>4HTTPDigestAuth.build_digest_header.<locals>.<lambda>   s    )qc1#J/r   /?r   08xri   :N   N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="zDigest )rS   r[   getupperr   pathqueryr   r   rY   rZ   r   r   timectimeosurandomrj   rs   rl   split)r!   methodurlra   rb   rc   rd   re   
_algorithmro   rt   rx   r}   KDentdigp_parsedr   A1A2HA1HA2ncvaluer   cnoncerespdignoncebitbaser   s   &&&                        @r   build_digest_header"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wa7xqmm&&111**a/*-.D*''33C8""../66w?	U\\'""	TZZ\  ))	RZZ]a**,S1#se1UG1VH56Cq./GF]f		#6'!F86#?Hh'G (-% z%
5' J6wiq2 	 j**DmI;a00Dj**D'y
6(!DDDr   c                P    VP                   '       d   ^V P                  n        R# R# )z)Reset num_401_calls counter on redirects.N)is_redirectrS   r]   )r!   r"   kwargss   &&,r   handle_redirectHTTPDigestAuth.handle_redirect   s    ===/0D, r   c                   RVP                   u;8:  d   R8  g   M ^V P                  n        V# V P                  P                  e:   VP                  P
                  P                  V P                  P                  4       VP                  P                  RR4      pRVP                  4       9   Ed   V P                  P                  ^8  Ede   V P                  ;P                  ^,          un        \        P                  ! R\        P                  R7      p\        VP                  RV^R7      4      V P                  n        VP                    VP#                  4        VP                  P%                  4       p\'        VP(                  VP                  VP*                  4       VP-                  VP(                  4       V P/                  VP0                  VP2                  4      VP                  R	&   VP4                  P6                  ! V3/ VB pVP8                  P;                  V4       WVn        V# ^V P                  n        V# )
zW
Takes the given response and tries digest-auth, if needed.

:rtype: requests.Response
i  i  zwww-authenticaterW   digestzdigest )flags)countrF   )status_coderS   r]   r\   requestbodyseekrH   r   lowerrecompile
IGNORECASEr   subr[   contentclosecopyr   _cookiesrawprepare_cookiesr   r   r   
connectionsendhistoryappend)r!   r"   r   s_authpatprep_rs   &&,    r   
handle_401HTTPDigestAuth.handle_401   s    amm)c)/0D,H!!- IINN 2 2 6 67126v||~%$*<*<*J*JQ*N,,1,**Zr}}=C&7FRS8T&UD# IIGGI99>>#D"4==!))QUUC  /,0,D,DTXX-DLL) ""4262BJJa JI+,(r   c                   V P                  4        V P                  P                  '       d4   V P                  VP                  VP
                  4      VP                  R &    VP                  P                  4       V P                  n	        VP                  RV P                  4       VP                  RV P                  4       ^V P                  n        V#   \         d    RT P                  n	         Lii ; i)rF   Nresponse)r^   rS   rY   r   r   r   rH   r   tellr\   AttributeErrorregister_hookr   r   r]   r    s   &&r   r#   HTTPDigestAuth.__call__  s    ""$((()-)A)A!((AEE)RAIIo&	*%&VV[[]D" 	

DOO4	
D$8$89+,(  	*
 &*D"	*s   !)C C43C4c           	     |    \        V P                  \        VR R4      8H  V P                  \        VRR4      8H  .4      # r8   r9   r<   s   &&r   r>   HTTPDigestAuth.__eq__1  r@   r   c                    W8X  * # r3   r%   r<   s   &&r   rB   HTTPDigestAuth.__ne__9  rD   r   )rS   r   r   N)r'   r(   r)   r*   r+   r5   r^   r   r   r   r#   r>   rB   r,   r-   r.   s   @r   rO   rO   k   s8     J/4l \1
*X(
! !r   rO   )r+   rj   r   r   rQ   r   r   base64r   _internal_utilsr   compatr   r   r   cookiesr   utilsr   CONTENT_TYPE_FORM_URLENCODEDCONTENT_TYPE_MULTI_PARTr   r   r1   rK   rO   r%   r   r   <module>r      st     	 	     - - - + $B / )XB BH .M O!X O!r   