ó
    °"³j€-  ã                  óL  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
  SSKJr  SSKJrJrJr  SSKJrJr  \R(                  (       a  S S	KJr  / S
Qr " S S5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\R8                  5      rg)é    )ÚannotationsN)Ú	b64encode)Úparse_http_listé   )ÚProtocolError)ÚCookiesÚRequestÚResponse)Úto_bytesÚto_str)Ú_Hash)ÚAuthÚ	BasicAuthÚ
DigestAuthÚFunctionAuthÚ	NetRCAuthc                  ó>   • \ rS rSrSrSrSrS	S jrS	S jrS
S jr	Sr
g)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              #  ó   #   • Uv •  g7f)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.
N© ©ÚselfÚrequests     ÚI/home/mande/repo/quber/.venv/lib/python3.13/site-packages/httpx2/_auth.pyÚ	auth_flowÚAuth.auth_flow&   s   é € ð, ‹ùs   ‚c              #  ó  #   • U R                   (       a  UR                  5         U R                  U5      n[        U5      n Uv •nU R                  (       a  UR                  5          UR                  U5      nM9  ! [         a     gf = f7f)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>   sw   é € ð ×%×%Ø�L‰LŒNà�~‰~˜gÓ&ˆÜ�t“*ˆàØ$‘}ˆHØ×*×*Ø—‘”ðØŸ)™) HÓ-�ñ øô !ó Ùðüs*   ‚A$B
Á'A: Á8B
Á:
BÂB
ÂBÂB
c               óB  #   • U R                   (       a  UR                  5       I Sh  v•N   U R                  U5      n[        U5      n U7v •nU R                  (       a  UR                  5       I Sh  v•N    UR                  U5      nMB   Nc N! [         a     gf = f7f)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_flowU   sŽ   é € ð ×%×%Ø—-‘-“/×!Ð!à�~‰~˜gÓ&ˆÜ�t“*ˆàØ$’}ˆHØ×*×*Ø—n‘nÓ&×&Ð&ðØŸ)™) HÓ-�ñ ñ "ñ 'øô !ó ÙðüsF   ‚%B§B¨A
BÁ2BÁ3BÁ8B Â	BÂBÂ
BÂBÂBÂBr   N©r   r	   Úreturnz)typing.Generator[Request, Response, None])r   r	   r.   z(typing.AsyncGenerator[Request, Response])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r!   r   r'   r+   Ú__static_attributes__r   ó    r   r   r      s$   † ñ
ð "ÐØ"Ðôô0÷.r5   r   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	r   ém   z…
Allows the 'auth' argument to be passed as a simple callable function,
that takes the request, and returns a new, modified request.
c                ó   • Xl         g ©N©Ú_func)r   Úfuncs     r   Ú__init__ÚFunctionAuth.__init__s   s   € Ø�
r5   c              #  ó2   #   • U R                  U5      v •  g 7fr9   r:   r   s     r   r   ÚFunctionAuth.auth_flowv   s   é € Ø�j‰j˜Ó!Ó!ùs   ‚r:   N)r<   z#typing.Callable[[Request], Request]r.   ÚNoner-   )r/   r0   r1   r2   r3   r=   r   r4   r   r5   r   r   r   m   s   † ñô
÷"r5   r   c                  ó6   • \ rS rSrSrSS jrS	S jrS
S jrSrg)r   éz   zm
Allows the 'auth' argument to be passed as a (username, password) pair,
and uses HTTP Basic authentication.
c                ó0   • U R                  X5      U l        g r9   )Ú_build_auth_headerÚ_auth_header©r   ÚusernameÚpasswords      r   r=   ÚBasicAuth.__init__€   s   € Ø ×3Ñ3°HÓGˆÕr5   c              #  óF   #   • U R                   UR                  S'   Uv •  g 7f)NÚAuthorization)rF   Úheadersr   s     r   r   ÚBasicAuth.auth_flowƒ   s   é € Ø+/×+<Ñ+<ˆ�‰˜Ñ(Ø‹ùs   ‚!c                óˆ   • SR                  [        U5      [        U5      45      n[        U5      R                  5       nSU 3$ ©Nó   :zBasic ©Újoinr   r   Údecode©r   rH   rI   ÚuserpassÚtokens        r   rE   ÚBasicAuth._build_auth_header‡   ó?   € Ø—9‘9œh xÓ0´(¸8Ó2DÐEÓFˆÜ˜(Ó#×*Ñ*Ó,ˆØ˜�wÐÐr5   )rF   N©rH   ústr | bytesrI   r[   r.   rA   r-   ©rH   r[   rI   r[   r.   Ústr©	r/   r0   r1   r2   r3   r=   r   rE   r4   r   r5   r   r   r   z   s   † ñô
Hô÷ r5   r   c                  ó:   • \ rS rSrSrSS	S jjrS
S jrSS jrSrg)r   é�   zL
Use a 'netrc' file to lookup basic auth credentials based on the url host.
Nc                ó8   • SS K nUR                  U5      U l        g )Nr   )ÚnetrcÚ_netrc_info)r   Úfilerb   s      r   r=   ÚNetRCAuth.__init__’   s   € ó 	à Ÿ;™; tÓ,ˆÕr5   c              #  óÜ   #   • U R                   R                  UR                  R                  5      nUb
  US   (       d  Uv •  g U R	                  US   US   S9UR
                  S'   Uv •  g 7f)Né   r   )rH   rI   rL   )rc   ÚauthenticatorsÚurlÚhostrE   rM   )r   r   Ú	auth_infos      r   r   ÚNetRCAuth.auth_flow™   si   é € Ø×$Ñ$×3Ñ3°G·K±K×4DÑ4DÓEˆ	ØÑ I¨a§Là‹Mð 04×/FÑ/FÐPYÐZ[ÑP\ÐgpÐqrÑgsÐ/FÐ/tˆG�O‰O˜OÑ,Ø‹Mùs   ‚A*A,c                óˆ   • SR                  [        U5      [        U5      45      n[        U5      R                  5       nSU 3$ rP   rR   rU   s        r   rE   ÚNetRCAuth._build_auth_header£   rY   r5   )rc   r9   )rd   z
str | Noner.   rA   r-   r\   r^   r   r5   r   r   r   �   s   † ñö-ô÷ r5   r   c            	      ó  • \ rS rSr% \R
                  \R
                  \R                  \R                  \R                  \R                  \R                  \R                  S.r	S\
S'   SS jrSS jrSS jrSS jrSS	 jrSS
 jrSS jrSrg)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                ó`   • [        U5      U l        [        U5      U l        S U l        SU l        g )Nr   )r   Ú	_usernameÚ	_passwordÚ_last_challengeÚ_nonce_countrG   s      r   r=   ÚDigestAuth.__init__µ   s*   € Ü! (Ó+ˆŒÜ! (Ó+ˆŒØ<@ˆÔØˆÕr5   c              #  óT  #   • U R                   (       a(  U R                  XR                   5      UR                  S'   Uv •nUR                  S:w  d  SUR                  ;  a  g UR                  R	                  S5       H)  nUR                  5       R                  S5      (       d  M)    O   g U R                  XU5      U l         SU l        U R                  XR                   5      UR                  S'   UR                  (       a"  [        UR                  5      R                  US9  Uv •  g 7f)NrL   i‘  zwww-authenticatezdigest r   ©r   )rw   rE   rM   Ústatus_codeÚget_listÚlowerÚ
startswithÚ_parse_challengerx   Úcookiesr   Úset_cookie_header)r   r   r&   Úauth_headers       r   r   ÚDigestAuth.auth_flow»   sú   é € Ø××Ø/3×/FÑ/FÀw×PdÑPdÓ/eˆG�O‰O˜OÑ,à ‘=ˆà×Ñ 3Ó&Ð*<ÀH×DTÑDTÓ*Tð à#×+Ñ+×4Ñ4Ð5GÖHˆKØ× Ñ Ó"×-Ñ-¨i×8Ó8Ùñ Ið à#×4Ñ4°WÈÓTˆÔØˆÔà+/×+BÑ+BÀ7×L`ÑL`Ó+aˆ�‰˜Ñ(Ø××Ü�H×$Ñ$Ó%×7Ñ7ÀÐ7ÑHØ‹ùs   ‚BD(Â%BD(c                ó  • UR                  S5      u  pEnUR                  5       S:X  d   e0 n[        U5       H8  nUR                  5       R	                  SS5      u  pšU
R                  S5      Xy'   M:      US   R                  5       nUS   R                  5       nUR                  SS	5      nS
U;   a  US
   R                  5       OSnSU;   a  US   R                  5       OSn[        X¼XÞUS9$ ! [         a  nSn[        UUS9UeSnAff = f)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Ú=r   Ú"ÚrealmÚnonceÚ	algorithmrq   ÚopaqueNÚqop)rŠ   r‹   rŒ   r�   rŽ   z(Malformed Digest WWW-Authenticate headerr{   )
Ú	partitionr~   r   ÚstripÚsplitÚencodeÚgetÚ_DigestAuthChallengeÚ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°!Ó4‰JˆCØ$Ÿ{™{¨3Ó/ˆKÓñ -ð		CØ Ñ(×/Ñ/Ó1ˆEØ Ñ(×/Ñ/Ó1ˆEØ#Ÿ™¨°UÓ;ˆIØ7?À;Ó7N�[ Ñ*×1Ñ1Ô3ÐTXˆFØ16¸+Ó1E�+˜eÑ$×+Ñ+Ô-È4ˆCÜ'¨eÈIÐjmÑnÐnøÜó 	CØ@ˆGÜ °Ñ9¸sÐBûð	Cús   Á5A8C. Ã.
D
Ã8DÄD
c           	     óL  ^• U R                   UR                  R                  5          mSU4S jjnSR                  U R                  UR
                  U R                  45      nUR                  R                  nSR                  UR                  R                  5       U45      nU" U5      nSU R                  -  nU R                  U R                  UR                  5      n	U =R                  S-  sl        U" U5      n
UR                  R                  5       R                  S5      (       a#  U" SR                  X¢R                  U	45      5      n
U R!                  UR"                  US9nUc  X¢R                  U/nOX¢R                  X‰X·/nU R                  UR
                  UR                  UU" SR                  U5      5      UR                  R                  5       S.nUR$                  (       a  UR$                  US'   U(       a  S	US
'   X�S'   X�S'   SU R'                  U5      -   $ )Nc                óL   >• T" U 5      R                  5       R                  5       $ r9   )Ú	hexdigestr’   )ÚdataÚ	hash_funcs    €r   r‡   Ú-DigestAuth._build_auth_header.<locals>.digestô   s   ø€ Ù˜T“?×,Ñ,Ó.×5Ñ5Ó7Ð7r5   rQ   s   %08xr   z-sessr{   )rH   rŠ   r‹   Úurir&   rŒ   r�   ó   authrŽ   ÚncÚcnoncezDigest )r£   Úbytesr.   rª   )rs   rŒ   ÚupperrS   ru   rŠ   rv   ri   Úraw_pathÚmethodr’   rx   Ú_get_client_noncer‹   r~   ÚendswithÚ_resolve_qoprŽ   r�   Ú_get_header_value)r   r   Ú	challenger‡   ÚA1ÚpathÚA2ÚHA2Únc_valuer©   ÚHA1rŽ   Údigest_dataÚformat_argsr¤   s                 @r   rE   ÚDigestAuth._build_auth_headerñ   sÔ  ø€ Ø×4Ñ4°Y×5HÑ5H×5NÑ5NÓ5PÑQˆ	÷	8ð �Y‰Y˜Ÿ™¨	¯©¸¿¹ÐHÓIˆà�{‰{×#Ñ#ˆØ�Y‰Y˜Ÿ™×-Ñ-Ó/°Ð6Ó7ˆá�R‹jˆà˜T×.Ñ.Ñ.ˆØ×'Ñ'¨×(9Ñ(9¸9¿?¹?ÓKˆØ×Ò˜QÑÕá�R‹jˆØ×Ñ×$Ñ$Ó&×/Ñ/°×8Ñ8Ù˜Ÿ™ C¯©¸&Ð#AÓBÓCˆCà×Ñ 	§¡°wÐÐ?ˆØ‰;à§¡°Ð5‰Kð §¡°À3ÐLˆKð Ÿ™Ø—_‘_Ø—_‘_ØÙ˜tŸy™y¨Ó5Ó6Ø"×,Ñ,×3Ñ3Ó5ñ
ˆð ××Ø$-×$4Ñ$4ˆK˜Ñ!ÞØ!(ˆK˜ÑØ (˜ÑØ$*˜Ñ!à˜4×1Ñ1°+Ó>Ñ>Ð>r5   c                ó$  • [        U5      R                  5       nX2-  nU[        R                  " 5       R                  5       -  nU[        R
                  " S5      -  n[        R                  " U5      R                  5       S S R                  5       $ )Né   é   )	r]   r’   ÚtimeÚctimeÚosÚurandomÚhashlibÚsha1r¢   )r   Únonce_countr‹   Úss       r   r®   ÚDigestAuth._get_client_nonce  sn   € Ü�Ó×#Ñ#Ó%ˆØ	‰
ˆØ	ŒT�ZŠZ‹\× Ñ Ó"Ñ"ˆØ	ŒR�ZŠZ˜‹]Ñˆä�|Š|˜A‹×(Ñ(Ó*¨3¨BÐ/×6Ñ6Ó8Ð8r5   c                óÂ   • SnSnSnSn[        UR                  5       5       H9  u  nu  pxUS:”  a  US-  nXr;  a  UOUn	XYR                  U[        U5      5      -  nM;     U$ )N)rŒ   rŽ   r¨   z{}="{}"z{}={}Ú r   z, )Ú	enumerateÚitemsÚformatr   )
r   Úheader_fieldsÚNON_QUOTED_FIELDSÚQUOTED_TEMPLATEÚNON_QUOTED_TEMPLATEÚheader_valueÚirš   rœ   Útemplates
             r   r±   ÚDigestAuth._get_header_value'  su   € Ø6ÐØ#ˆØ%ÐàˆÜ!*¨=×+>Ñ+>Ó+@Ö!AÑˆA‰~�Ø�1‹uØ Ñ$�Ø*/Ó*H‘ÐNaˆHØŸO™O¨E´6¸%³=ÓAÑAŠLñ	 "Bð Ðr5   c                óŠ   • Uc  g [         R                  " SU5      nSU;   a  gUS/:X  a  [        S5      eSU< S3n[        XBS9e)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_qop5  sT   € Ø‰;ØÜ�xŠx˜ Ó$ˆØ�d‹?Øà�K�=Ó Ü%Ð&VÓWÐWà*¨3©'Ð1AÐBˆÜ˜GÑ5Ð5r5   )rw   rx   rv   ru   NrZ   r-   )r   r	   r&   r
   rƒ   r]   r.   r”   )r   r	   r²   r”   r.   r]   )rÅ   Úintr‹   rª   r.   rª   )rÍ   zdict[str, bytes]r.   r]   )rŽ   úbytes | Noner   r	   r.   rÛ   )r/   r0   r1   r2   rÃ   Úmd5rÄ   Úsha256Úsha512rs   Ú__annotations__r=   r   r€   rE   r®   r±   r°   r4   r   r5   r   r   r   ©   sp   ‡ à�{‰{Ø—K‘KØ�|‰|Ø—L‘LØ—>‘>ØŸ™Ø—>‘>ØŸ™ñ	OÐÐ!Kó 	ôôô6Cô6,?ô\9ô÷6r5   r   c                  óH   • \ rS rSr% S\S'   S\S'   S\S'   S\S'   S\S	'   S
rg)r”   iC  rª   rŠ   r‹   r]   rŒ   rÛ   r�   rŽ   r   N)r/   r0   r1   r2   rß   r4   r   r5   r   r”   r”   C  s   ‡ ØƒLØƒLØƒNØÓØ	Ör5   r”   )Ú
__future__r   rÃ   rÁ   rÖ   r¿   ÚtypingÚbase64r   Úurllib.requestr   Ú_exceptionsr   Ú_modelsr   r	   r
   Ú_utilsr   r   ÚTYPE_CHECKINGr   Ú__all__r   r   r   r   r   Ú
NamedTupler”   r   r5   r   Ú<module>rë      s�   ðÝ "ã Û 	Û 	Û Û Ý Ý *å &ß /Ñ /ß $à	××Ýò K€÷Tñ Tôn
"�4ô 
"ô �ô  ô& �ô  ô8W6�ô W6ôt˜6×,Ñ,õ r5   