+
    is.                    T   ^ RI H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 ^RIHtHtHt ^RIHtHtHt ]P*                  '       d   ^ RIHt . ROt ! R R	4      t ! R R]4      t ! R R
]4      t ! R R]4      t ! R R]4      t ! R R]P:                  4      tR# )    )annotationsN)	b64encode)parse_http_list)ProtocolError)CookiesRequestResponse)to_bytesto_strunquote)_HashAuth	BasicAuth
DigestAuth	NetRCAuthc                  F    ] tR t^tRtRtRtR R ltR R ltR R lt	R	t
R
# )r   a  
Base class for all authentication schemes.

To implement a custom authentication scheme, subclass `Auth` and override
the `.auth_flow()` method.

If the authentication scheme does I/O such as disk access or network calls, or uses
synchronization primitives such as locks, you should override `.sync_auth_flow()`
and/or `.async_auth_flow()` instead of `.auth_flow()` to provide specialized
implementations that will be used by `Client` and `AsyncClient` respectively.
Fc                    V ^8  d   QhRRRR/#    requestr   returnz)typing.Generator[Request, Response, None] )formats   "^/Users/igloo/.openclaw/workspace/scratch/fb_ad_env/lib/python3.14/site-packages/httpx/_auth.py__annotate__Auth.__annotate__&   s       -V     c              #     "   Vx  R# 5i)a  
Execute the authentication flow.

To dispatch a request, `yield` it:

```
yield request
```

The client will `.send()` the response back into the flow generator. You can
access it like so:

```
response = yield request
```

A `return` (or reaching the end of the generator) will result in the
client returning the last response obtained from the server.

You can dispatch as many requests as is necessary.
Nr   selfr   s   &&r   	auth_flowAuth.auth_flow&   s     , s   	c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   >   s      	2r   c              #     "   V P                   '       d   VP                  4        V P                  V4      p\        V4      p Vx pV P                  '       d   VP                  4         VP                  V4      pK;    \         d     R# i ; i5i)z
Execute the authentication flow synchronously.

By default, this defers to `.auth_flow()`. You should override this method
when the authentication scheme does I/O and/or uses concurrency primitives.
N)requires_request_bodyreadr!   nextrequires_response_bodysendStopIterationr    r   flowresponses   &&  r   sync_auth_flowAuth.sync_auth_flow>   sv      %%%LLN~~g&t*$}H***))H-  s0   ABB)A< :B<BB
BBc                    V ^8  d   QhRRRR/# )r   r   r   r   z(typing.AsyncGenerator[Request, Response]r   )r   s   "r   r   r   W   s      	1r   c               J  "   V P                   '       d   VP                  4       G Rj  xL
  V P                  V4      p\        V4      p V5x pV P                  '       d   VP                  4       G Rj  xL
   VP                  V4      pKD   Ld L  \         d     R# i ; i5i)z
Execute the authentication flow asynchronously.

By default, this defers to `.auth_flow()`. You should override this method
when the authentication scheme does I/O and/or uses concurrency primitives.
N)r%   areadr!   r'   r(   r)   r*   r+   s   &&  r   async_auth_flowAuth.async_auth_flowW   s      %%%--/!!~~g&t*$}H***nn&&&))H- " ' ! sK   &B#B7B#!B#4B5B#:B B#B#B B#B  B#r   N)__name__
__module____qualname____firstlineno____doc__r%   r(   r!   r.   r3   __static_attributes__r   r   r   r   r      s)    
 ""02 r   c                  2    ] tR t^qtRtR R ltR R ltRtR# )FunctionAuthz
Allows the 'auth' argument to be passed as a simple callable function,
that takes the request, and returns a new, modified request.
c                    V ^8  d   QhRRRR/# )r   funcz#typing.Callable[[Request], Request]r   Noner   )r   s   "r   r   FunctionAuth.__annotate__w   s      @ T r   c                	    Wn         R # N_func)r    r>   s   &&r   __init__FunctionAuth.__init__w   s    
r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r@   z   s     " " "-V "r   c              #  	4   "   V P                  V4      x  R # 5irB   rC   r   s   &&r   r!   FunctionAuth.auth_flowz   s     jj!!s   rC   N)r5   r6   r7   r8   r9   rE   r!   r:   r   r   r   r<   r<   q   s    
" "r   r<   c                  >    ] tR t^~tRtR R ltR R ltR R ltRtR	# )
r   zm
Allows the 'auth' argument to be passed as a (username, password) pair,
and uses HTTP Basic authentication.
c               $    V ^8  d   QhRRRRRR/# r   usernamestr | bytespasswordr   r?   r   )r   s   "r   r   BasicAuth.__annotate__   s&     H H H H Hr   c                	2    V P                  W4      V n        R # rB   )_build_auth_header_auth_headerr    rM   rO   s   &&&r   rE   BasicAuth.__init__   s     33HGr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rP      s       -V r   c              #  	H   "   V P                   VP                  R &   Vx  R# 5i)AuthorizationN)rS   headersr   s   &&r   r!   BasicAuth.auth_flow   s     +/+<+<(s    "c               $    V ^8  d   QhRRRRRR/# r   rM   rN   rO   r   strr   )r   s   "r   r   rP      "        ;  +  RU  r   c                	    R P                  \        V4      \        V4      34      p\        V4      P                  4       pRV 2#    :zBasic joinr
   r   decoder    rM   rO   userpasstokens   &&&  r   rR   BasicAuth._build_auth_header   ?    99hx0(82DEF(#**,wr   )rS   N	r5   r6   r7   r8   r9   rE   r!   rR   r:   r   r   r   r   r   ~   s    
H   r   c                  B    ] tR t^tRtR
R R lltR R ltR R ltR	tR# )r   zL
Use a 'netrc' file to lookup basic auth credentials based on the url host.
Nc                    V ^8  d   QhRRRR/# )r   filez
str | Noner   r?   r   )r   s   "r   r   NetRCAuth.__annotate__   s     - -Z -4 -r   c                	:    ^ RI pVP                  V4      V n        R# )r   N)netrc_netrc_info)r    rm   rp   s   && r   rE   NetRCAuth.__init__   s     	 ;;t,r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rn      s     
 
 
-V 
r   c              #  	  "   V P                   P                  VP                  P                  4      pVe   V^,          '       g   Vx  R # V P	                  V^ ,          V^,          R7      VP
                  R&   Vx  R # 5i)N)rM   rO   rX   )rq   authenticatorsurlhostrR   rY   )r    r   	auth_infos   && r   r!   NetRCAuth.auth_flow   sm     $$33GKK4D4DE	IaLLM 04/F/F"1	! 0G 0GOOO, Ms   AA?:A?c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   rn      r^   r   c                	    R P                  \        V4      \        V4      34      p\        V4      P                  4       pRV 2# r`   rb   re   s   &&&  r   rR   NetRCAuth._build_auth_header   ri   r   )rq   rB   rj   r   r   r   r   r      s    -
   r   c                  :   ] tR t^t$ R]P
                  R]P
                  R]P                  R]P                  R]P                  R]P                  R]P                  R]P                  /t	R	]
R
&   R R ltR R ltR R ltR R ltR R ltR R ltR R ltRtR# )r   MD5zMD5-SESSSHAzSHA-SESSzSHA-256zSHA-256-SESSzSHA-512zSHA-512-SESSz*dict[str, typing.Callable[[bytes], _Hash]]_ALGORITHM_TO_HASH_FUNCTIONc               $    V ^8  d   QhRRRRRR/# rL   r   )r   s   "r   r   DigestAuth.__annotate__   s!         r   c                	b    \        V4      V n        \        V4      V n        R V n        ^V n        R # rB   )r
   	_username	_password_last_challenge_nonce_countrT   s   &&&r   rE   DigestAuth.__init__   s*    !(+!(+<@r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r      s       -V r   c              #  	j  "   V P                   '       d)   V P                  WP                   4      VP                  R &   Vx pVP                  R8w  g   RVP                  9  d   R# VP                  P	                  R4       F*  pVP                  4       P                  R4      '       g   K*   M	  R# V P                  WV4      V n         ^V n        V P                  WP                   4      VP                  R &   VP                  '       d&   \        VP                  4      P                  VR7       Vx  R# 5i)rX   i  zwww-authenticateNzdigest r   )r   rR   rY   status_codeget_listlower
startswith_parse_challenger   cookiesr   set_cookie_header)r    r   r-   auth_headers   &&  r   r!   DigestAuth.auth_flow   s
    /3/F/F--0GOOO, !=3&*<HDTDT*T #++445GHK  "--i88 I #44WT+/+B+B)),
( H$$%777Hs   B#D3*B	D3c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r-   r	   r   r]   r   _DigestAuthChallenger   )r   s   "r   r   r      s2     C CC*2CADC	Cr   c                B   VP                  R4      w  rEpVP                  4       R8X  g   Q h/ p\        V4       F2  pVP                  4       P	                  R^4      w  r\        V
4      Wy&   K4  	   VR,          P                  4       pVR,          P                  4       pVP                  RR4      pRV9   d   VR,          P                  4       MR	pR
V9   d   VR
,          P                  4       MR	p\        WWVR7      #   \         d   pRp\        TTR7      ThR	p?ii ; i)z
Returns a challenge from a Digest WWW-Authenticate header.
These take the form of:
`Digest realm="realm@host.com",qop="auth,auth-int",nonce="abc",opaque="xyz"`
 digest=realmnonce	algorithmr~   opaqueNqop)r   r   r   r   r   z(Malformed Digest WWW-Authenticate headerr   )	partitionr   r   stripsplitr   encodegetr   KeyErrorr   )r    r   r-   r   scheme_fieldsheader_dictfieldkeyvaluer   r   r   r   r   excmessages   &&&&              r   r   DigestAuth._parse_challenge   s    (11#66 ||~)))&($V,E,,S!4JC&u~K -	C(//1E(//1E#U;I7?;7N[*113TXF16+1E+e$++-4C'IRU   	C@G9sB	Cs   0BC> >D	DDc               $    V ^8  d   QhRRRRRR/# )r   r   r   	challenger   r   r]   r   )r   s   "r   r   r      s$     .? .?.?+?.?	.?r   c                	  a V P                   VP                  P                  4       ,          oR  V3R llpRP                  V P                  VP
                  V P                  34      pVP                  P                  pRP                  VP                  P                  4       V34      pV! V4      pRV P                  ,          pV P                  V P                  VP                  4      p	V ;P                  ^,          un        V! V4      p
VP                  P                  4       P                  R4      '       d$   V! RP                  WP                  V	34      4      p
V P!                  VP"                  VR7      pVf   WP                  V.pMWP                  WW.pRV P                  RVP
                  RVP                  R	VR
V! RP                  V4      4      RVP                  P                  4       /pVP$                  '       d   VP$                  VR&   V'       d   RVR&   WR&   WR&   RV P'                  V4      ,           # )c                    V ^8  d   QhRRRR/# )r   databytesr   r   )r   s   "r   r   3DigestAuth._build_auth_header.<locals>.__annotate__  s     	8 	8 	85 	8r   c                L   < S! V 4      P                  4       P                  4       # rB   )	hexdigestr   )r   	hash_funcs   &r   r   -DigestAuth._build_auth_header.<locals>.digest  s    T?,,.5577r   ra   s   %08xz-sessr   rM   r   r   urir-   r   r      authr   nccnoncezDigest )r   r   upperrc   r   r   r   rv   raw_pathmethodr   r   _get_client_noncer   r   endswith_resolve_qopr   r   _get_header_value)r    r   r   r   A1pathA2HA2nc_valuer   HA1r   digest_dataformat_argsr   s   &&&           @r   rR   DigestAuth._build_auth_header   s    44Y5H5H5N5N5PQ		8 	8 YY	HI{{##YY--/67RjT...''(9(99??KQRj$$&//88C&#ABCC	w?;5K 3LK Y__Y__4tyy56,,335
 $-$4$4K!!(K ($*!411+>>>r   c               $    V ^8  d   QhRRRRRR/# )r   nonce_countintr   r   r   r   )r   s   "r   r   r   /  s!     9 9S 9 95 9r   c                	D   \        V4      P                  4       pW2,          pV\        P                  ! 4       P                  4       ,          pV\        P
                  ! ^4      ,          p\        P                  ! V4      P                  4       R,          P                  4       # )   :N   N)	r]   r   timectimeosurandomhashlibsha1r   )r    r   r   ss   &&& r   r   DigestAuth._get_client_nonce/  sl    ##%	
	TZZ\  ""	RZZ]||A((*3/6688r   c                    V ^8  d   QhRRRR/# )r   header_fieldszdict[str, bytes]r   r]   r   )r   s   "r   r   r   7  s      /? C r   c                	    RpRpRpRp\        VP                  4       4       FC  w  pw  rxV^ 8  d
   VR,          pWr9  d   TMTp	WYP                  V\        V4      4      ,          pKE  	  V# )r   z{}="{}"z{}={} z, )r   r   r   )	enumerateitemsr   r   )
r    r   NON_QUOTED_FIELDSQUOTED_TEMPLATENON_QUOTED_TEMPLATEheader_valueir   r   templates
   &&        r   r   DigestAuth._get_header_value7  s    6#%!*=+>+>+@!AA~1u$ 1  ( 
 OOE6%=AAL "B r   c               $    V ^8  d   QhRRRRRR/# )r   r   bytes | Noner   r   r   r   )r   s   "r   r   r   I  s!     6 6 6w 6< 6r   c                	    Vf   R # \         P                  ! RV4      pRV9   d   R# VR.8X  d   \        R4      hRV: R2p\        WBR7      h)Ns   , ?r   s   auth-intz.Digest auth-int support is not yet implementedzUnexpected qop value "z" in digest authr   )rer   NotImplementedErrorr   )r    r   r   qopsr   s   &&&  r   r   DigestAuth._resolve_qopI  sT    ;xx$d?K= %&VWW*3'1ABG55r   )r   r   r   r   N)r5   r6   r7   r8   r   md5r   sha256sha512r   __annotations__rE   r!   r   rR   r   r   r   r:   r   r   r   r   r      s    w{{GKKw||GLL7>>7>>	O!K 	>C>.?`9$6 6r   c                  J    ] tR tRt$ R]R&   R]R&   R]R&   R]R&   R]R	&   R
tR# )r   iW  r   r   r   r]   r   r   r   r   r   N)r5   r6   r7   r8   r   r:   r   r   r   r   r   W  s    LLN	r   r   )r   r   r   r   )
__future__r   r   r   r   r   typingbase64r   urllib.requestr   _exceptionsr   _modelsr   r   r	   _utilsr
   r   r   TYPE_CHECKINGr   __all__r   r<   r   r   r   
NamedTupler   r   r   r   <module>r      s    "  	 	    * & / / - -	 ;X Xv
"4 
"   &   <e6 e6P6,, r   