+
     h'w  c                   s   R 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 ^RIHt ^RIHtHtHtHt ^RIHtHtHtHt ^R	IHtHtHtHt ^R
IHtHt ^RI H!t!H"t"H#t#H$t$ ^RI%H&t& ^RI'H(t( ^RI)H*t*H+t+H,t,H-t-H.t.H/t/H0t0H1t1H2t2H3t3 ]Ph                  R8X  d   ]Pj                  t6M]P                  t6]3R lt7]3R lt8 ! R R4      t9 ! R R]94      t:R t;R# )z
requests.sessions
~~~~~~~~~~~~~~~~~

This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
N)OrderedDict)	timedelta)to_native_string)HTTPAdapter)_basic_auth_str)Mapping	cookieliburljoinurlparse)RequestsCookieJarcookiejar_from_dictextract_cookies_to_jarmerge_cookies)ChunkedEncodingErrorContentDecodingErrorInvalidSchemaTooManyRedirects)default_hooksdispatch_hook)DEFAULT_REDIRECT_LIMITREDIRECT_STATIPreparedRequestRequest)codes)CaseInsensitiveDict)
DEFAULT_PORTSdefault_headersget_auth_from_urlget_environ_proxiesget_netrc_authrequote_uriresolve_proxiesrewind_bodyshould_bypass_proxiesto_key_val_listZwin32c                sD   Vf   V # V f   V# \        V\        4      '       d   \        V \        4      '       g   V # V! \        V4      4      pVP                  \        V 4      4       VP	                  4        UUu. uF  w  rEVe   K  VNK  	  pppV F  pW7 K  	  V# u uppi )zDetermines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
)
isinstancer   r"   updateitems)Zrequest_settingZsession_setting
dict_classZmerged_settingkvZ	none_keyskey   &&&     6/usr/lib/python3.14/site-packages/requests/sessions.pymerge_settingr,   =   s      	?G,,OW1U1U @AN//:; "0!5!5!7E!7v1!7IE  	 Fs   9BBc                s    Ve   VP                  R4      . 8X  d   V # V e   V P                  R4      . 8X  d   V# \        WV4      # )zProperly merges both requests and session hooks.

This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
response)getr,   )Zrequest_hooksZsession_hooksr&   s   &&&r+   merge_hooksr/   [   sM      1 1* = C 1 1* = CzBB    c                   sH   a  ] tR t^jt o R tR tR	R ltR tR tR t	Rt
V tR# )
SessionRedirectMixinc                s    VP                   '       d1   VP                  R,          pVP                  R4      p\        VR4      # R# )z7Receives a Response. Returns a redirect URI or ``None``locationZlatin1Zutf8N)Zis_redirectheadersZencoder   )selfrespr2   s   && r+   get_redirect_targetZ(SessionRedirectMixin.get_redirect_targetk   s>     ||J/H  x0H#Hf55r0   c                s   \        V4      p\        V4      pVP                  VP                  8w  d   R# VP                  R8X  d6   VP                  R9   d%   VP                  R8X  d   VP                  R9   d   R# VP                  VP                  8g  pVP                  VP                  8g  p\        P
                  ! VP                  R4      R3pV'       g%   VP                  V9   d   VP                  V9   d   R# T;'       g    T# )zFDecide whether Authorization header should be removed when redirectingTZhttpNhttpsF)iP   N)i  N)r   ZhostnameschemeZportr   r.   )r4   Zold_urlZnew_urlZ
old_parsedZ
new_parsedZchanged_portZchanged_schemeZdefault_portr*   r+   should_strip_authZ&SessionRedirectMixin.should_strip_auth   s    g&
g&
*"5"55 ':-!!W,;. "*//9#**j.?.??%))**;*;TBDI</</ --~-r0   Nc	              +  sl  "   . p
V P                  V4      p\        VP                  4      P                  pV'       Ed<   VP	                  4       pV
P                  V4       V
R,          Vn         VP                   \        VP                  4      V P                  8  d   \        RV P                   R2VR7      hVP!                  4        VP#                  R4      '       d<   \        VP                  4      pRP%                  \'        VP(                  4      V.4      p\        V4      pVP                  R	8X  d   V'       d   VP+                  VR
7      pMVP                  '       d   VP                  pVP-                  4       pVP.                  '       g!   \1        VP                  \3        V4      4      pM\3        V4      p\'        V4      Vn        V P5                  W4       VP6                  \8        P:                  \8        P<                  39  d/   RpV F  pVP>                  PA                  VR4       K!  	  RVn!        VP>                  pVPA                  RR4       \E        VPF                  W!P                  4       \I        VPF                  V PJ                  4       VPM                  VPF                  4       V PO                  W4      pV PQ                  W4       VPR                  RJ;'       d    RV9   ;'       g    RV9   pV'       d   \U        V4       TpV'       d   Vx  EK  V PV                  ! V3RVRVRVRVRVRR/V	B p\E        V PJ                  WP                  4       V P                  V4      pVx  EKD  R#   \        \        \        3 d!    TP                  P                  RR7        EL6i ; i5i)zBReceives a Response. Returns a generator of Responses or Requests.:i   NNF)Zdecode_contentz	Exceeded z redirects.)r-   z//Z:Z )fragmentContent-LengthTransfer-EncodingNZCookiestreamtimeoutverifycertproxiesallow_redirects)r;   zContent-Typer<   ),r6   r   urlr:   ZcopyZappendhistorycontentr   r   ZRuntimeErrorrawZreadlenmax_redirectsr   close
startswithZjoinr   r8   Z_replaceZgeturlZnetlocr   r   rebuild_methodstatus_coder   Ztemporary_redirectZpermanent_redirectr3   popZbodyr   Z_cookiesr   cookiesZprepare_cookiesrebuild_proxiesrebuild_authZ_body_positionr    send)r4   r5   reqr=   r>   r?   r@   rA   yield_requestsZadapter_kwargsZhistrC   Zprevious_fragmentprepared_requestZparsed_rurlZparsedZpurged_headersZheaderr3   Z
rewindables   &&&&&&&&&,          r+   resolve_redirectsZ&SessionRedirectMixin.resolve_redirects   sR     &&t,$SWW-66c"xxz KK8DL4 4<< D$6$66& 2 23;?$ 
 JJL ~~d##&txx0hh 01C1C DcJK c]F"$):2CD$*OO!--/C
 ===dhhC(89!#&#3C#8  07 ((((( 
 "Y,F$,,00> -(, %&..GKK$'
 ##3#<#<c88L*33T\\B,,-=-F-FG **+;EG.5
 *88D   G+MM/Bg/M 
 ,- #C	yy	!	 $	 "		
 	 $	 %*	 %	 't||5ExxP ..t4
O  )*>M 4U34s\   ;N4/N4.M; :A%N4 AN4?$N4$-N4E%N48N4N4A N4;2N1-N40N11N4c                s   VP                   pVP                  pRV9   d0   V P                  VP                  P                  V4      '       d   VR V P                  '       d   \        V4      MRpVe   VP                  V4       R# R# )zWhen being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
ZAuthorizationN)r3   rC   r9   request	trust_envr   Zprepare_auth)r4   rT   r-   r3   rC   Znew_auth   &&&   r+   rP   Z!SessionRedirectMixin.rebuild_auth  s~    
 #**""g%$*@*@  #+
 +

 ( +/...>#&d))(3  r0   c                sV   VP                   p\        VP                  4      P                  p\	        WV P
                  4      pRV9   d   VR  \        WT,          4      w  rgVP                  R4      '       g   V'       d   V'       d   \        Wg4      VR&   V#   \         d    RRrv LGi ; i)ap  This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect).

This method also replaces the Proxy-Authorization header where
necessary.

:rtype: dict
zProxy-AuthorizationNr7   )
r3   r   rC   r8   r   rW   r   ZKeyErrorrJ   r   )r4   rT   rA   r3   r8   Znew_proxiesZusernameZpasswordr*   r+   rO   Z$SessionRedirectMixin.rebuild_proxies.  s     #***../66%&6P G+-.	,!2;3F!GH   ))h8-<X-PG)*  	,!%th	,s   B B('B(c                s   VP                   pVP                  \        P                  8X  d
   VR8w  d   RpVP                  \        P                  8X  d
   VR8w  d   RpVP                  \        P
                  8X  d
   VR8X  d   RpW1n         R# )zrWhen being redirected we may want to change the method of the request
based on certain specs or browser behavior.
HEADGETPOSTN)methodrL   r   Z	see_otherZfoundZmoved)r4   rT   r-   r\   s   &&& r+   rK   Z#SessionRedirectMixin.rebuild_methodM  su     "(( 5??2v7GF 5;;.6V3CF 5;;.6V3CF"(r0    )FNTNNF)__name__
__module____qualname____firstlineno__r6   r9   rU   rP   rO   rK   __static_attributes____classdictcell__Z__classdict__   @r+   r1   r1   j   s+     (.@yv4(>) )r0   r1   c                   s   a  ] tR tRt o Rt. ROtR tR tR tR t	RR lt
R	 tR
 tR tRR ltRR ltRR ltR tR tR tR tR tR tR tR tRtV tR# )Sessionid  aT  A Requests session.

Provides cookie persistence, connection-pooling, and configuration.

Basic Usage::

  >>> import requests
  >>> s = requests.Session()
  >>> s.get('https://httpbin.org/get')
  <Response [200]>

Or as a context manager::

  >>> with requests.Session() as s:
  ...     s.get('https://httpbin.org/get')
  <Response [200]>
c                s`   \        4       V n        R V n        / V n        \	        4       V n        / V n        RV n        RV n        R V n	        \        V n        RV n        \        / 4      V n        \        4       V n        V P#                  R\%        4       4       V P#                  R\%        4       4       R # )NFTzhttps://zhttp://)r   r3   authrA   r   hooksparamsr=   r?   r@   r   rH   rW   r
   rN   r    adaptersmountr   r4      &r+   __init__ZSession.__init__  s     '( 	
  #_

    	 4  +2. $

:{}-

9km,r0   c                s    V # Nr]   rl   rm   r+   	__enter__ZSession.__enter__  s    r0   c                s&    V P                  4        R # ro   )rI   )r4   Zargss   &*r+   __exit__ZSession.__exit__  s    

r0   c                s"   VP                   ;'       g    / p\        V\        P                  4      '       g   \	        V4      p\        \        \        4       V P                   4      V4      pVP                  pV P                  '       d0   V'       g(   V P                  '       g   \        VP                  4      p\        4       pVP                  VP                  P                  4       VP                  VP                  VP                   VP"                  \%        VP&                  V P&                  \(        R7      \%        VP*                  V P*                  4      \%        W@P                  4      V\-        VP.                  V P.                  4      R7
       V# )aS  Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`.

:param request: :class:`Request` instance to prepare with this
    session's settings.
:rtype: requests.PreparedRequest
)r&   )
r\   rC   filesdatajsonr3   ri   rg   rN   rh   )rN   r#   r   Z	CookieJarr
   r   r	   rg   rW   r   rC   r   Zpreparer\   upperrr   rs   rt   r,   r3   r   ri   r/   rh   )r4   rV   rN   Zmerged_cookiesrg   Zps   &&    r+   prepare_requestZSession.prepare_request  s    //''R '9#6#677)'2G '+-t||<g

 ||>>>$tyyy!'++.D			>>'')--!:M !=tYY/"gmmTZZ8 	 	
 r0   Nc                s<   \        VP                  4       TTTT;'       g    / TT;'       g    / VVVR7
      pV P                  V4      pT;'       g    / pV P                  VP                  WW4      pRV	RV
/pVP                  V4       V P                  ! V3/ VB pV# )a  Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object.

:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query
    string for the :class:`Request`.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
    object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the
    :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the
    :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the
    :class:`Request`.
:param files: (optional) Dictionary of ``'filename': file-like-objects``
    for multipart encoding upload.
:param auth: (optional) Auth tuple or callable to enable
    Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How many seconds to wait for the server to send
    data before giving up, as a float, or a :ref:`(connect timeout,
    read timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Set to True by default.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol or protocol and
    hostname to the URL of the proxy.
:param hooks: (optional) Dictionary mapping hook name to one event or
    list of events, event must be callable.
:param stream: (optional) whether to immediately download the response
    content. Defaults to ``False``.
:param verify: (optional) Either a boolean, in which case it controls whether we verify
    the server's TLS certificate, or a string, in which case it must be a path
    to a CA bundle to use. Defaults to ``True``. When set to
    ``False``, requests will accept any TLS certificate presented by
    the server, and will ignore hostname mismatches and/or expired
    certificates, which will make your application vulnerable to
    man-in-the-middle (MitM) attacks. Setting verify to ``False``
    may be useful during local development or testing.
:param cert: (optional) if String, path to ssl client cert file (.pem).
    If Tuple, ('cert', 'key') pair.
:rtype: requests.Response
)
r\   rC   r3   rr   rs   rt   ri   rg   rN   rh   r>   rB   )r   ru   rv   merge_environment_settingsrC   r$   rQ   )r4   r\   rC   ri   rs   r3   rN   rr   rg   r>   rB   rA   rh   r=   r?   r@   rt   rR   ZprepZsettingsZsend_kwargsr5   s   &&&&&&&&&&&&&&&&&     r+   rV   ZSession.request  s    ~ <<><<R
 ##C(--R22HHgv
 w
 	8$yy--r0   c                N    VP                  RR4       V P                  ! RV3/ VB # )zSends a GET request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
rB   TrZ   
setdefaultrV   r4   rC   kwargs   &&,r+   r.   ZSession.getQ  s+     	+T2||E31&11r0   c                rx   )zSends a OPTIONS request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
rB   TZOPTIONSry   r{   r}   r+   optionsZSession.options\  s+     	+T2||Is5f55r0   c                rx   )zSends a HEAD request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
rB   FrY   ry   r{   r}   r+   headZSession.headg  s+     	+U3||FC2622r0   c                s2    V P                   ! RV3RVRV/VB # )a  Sends a POST request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
    object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
r[   rs   rt   rV   )r4   rC   rs   rt   r|   s   &&&&,r+   postZSession.postr  s$     ||FCHdHHHHr0   c                .    V P                   ! RV3RV/VB # )aE  Sends a PUT request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
    object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
ZPUTrs   r   r4   rC   rs   r|      &&&,r+   putZSession.put  s     ||E3<T<V<<r0   c                r   )aG  Sends a PATCH request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
    object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
ZPATCHrs   r   r   r   r+   patchZSession.patch  s     ||GS>t>v>>r0   c                s*    V P                   ! RV3/ VB # )zSends a DELETE request. Returns :class:`Response` object.

:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
ZDELETEr   r{   r}   r+   deleteZSession.delete  s     ||Hc4V44r0   c                s   VP                  RV P                  4       VP                  RV P                  4       VP                  RV P                  4       RV9  d$   \	        WP
                  V P                  4      VR&   \        V\        4      '       d   \        R4      hVP                  RR4      pVP                  R4      pVP                  pV P                  VP                  R7      p\        4       pVP                   ! V3/ VB p\        4       V,
          p	\#        V	R	7      Vn        \'        R
WX3/ VB pVP(                  '       d?   VP(                   F.  p
\+        V P,                  V
P.                  V
P0                  4       K0  	  \+        V P,                  WP0                  4       V'       d%   V P2                  ! W3/ VB pV U
u. uF  qNK  	  pp
M. pV'       d)   VP5                  ^ V4       VP                  4       pWn        V'       g%    \7        V P2                  ! W3RR/VB 4      Vn        V'       g   VP<                   V# u up
i   \:         d     L(i ; i)z9Send a given PreparedRequest.

:rtype: requests.Response
r=   r?   r@   rA   z#You can only send PreparedRequests.rB   T)rC   )Zsecondsr-   rS   )rz   r=   r?   r@   r   rA   rW   r#   r   Z
ValueErrorrM   r.   rh   get_adapterrC   preferred_clockrQ   r   elapsedr   rD   r   rN   rV   rF   rU   ZinsertZnextZ_nextZStopIterationrE   )r4   rV   r|   rB   r=   rh   adapterZstartZrr   r5   ZgenrD   s   &&,          r+   rQ   ZSession.send  s    	(DKK0(DKK0&$)),F" /t~~ VF9 gw''BCC !**%6=H% ""w{{"3  ! LL+F+ "#e+g.	 *e9&9 999		&t||T\\488L " 	t||Wee< ((>v>C(+,tG,GG NN1a AI **1UdUfU II1 -$ ! s   
I#I IIc                s0   V P                   '       d   Ve   VP                  R4      MRp\        WR7      pVP                  4        F  w  rVP	                  W4       K  	  VRJ g   VfQ   \
        P                  P                  R4      ;'       g*    \
        P                  P                  R4      ;'       g    Tp\        W P                  4      p\        W0P                  4      p\        W@P                  4      p\        WPP                  4      pRVRVR	VR
V/# )zF
Check the environment and merge it with some settings.

:rtype: dict
Nno_proxy)r   TZREQUESTS_CA_BUNDLEZCURL_CA_BUNDLErA   r=   r?   r@   )rW   r.   r   r%   rz   osZenvironr,   rA   r=   r?   r@   )
r4   rC   rA   r=   r?   r@   r   Zenv_proxiesr'   r(   s
   &&&&&&    r+   rw   Z"Session.merge_environment_settings  s     >>>292Ew{{:.4H-cEK#))+""1( ,
 ~JJNN#78  zz~~&67    6v{{3v{{3T99-7HfhPTUUr0   c                s    V P                   P                  4        F<  w  r#VP                  4       P                  VP                  4       4      '       g   K:  Vu # 	  \	        RV: 24      h)zf
Returns the appropriate connection adapter for the given URL.

:rtype: requests.adapters.BaseAdapter
z&No connection adapters were found for )rj   r%   ZlowerrJ   r   )r4   rC   prefixr      &&  r+   r   ZSession.get_adapter  sT      $}}224OFyy{%%flln55  5
 DSGLMMr0   c                sh    V P                   P                  4        F  pVP                  4        K  	  R# )z+Closes all adapters and as such the sessionN)rj   ZvaluesrI   )r4   r(   s   & r+   rI   ZSession.close  s"    %%'AGGI (r0   c                s    W P                   V&   V P                    Uu. uF   p\        V4      \        V4      8  g   K  VNK"  	  ppV F+  pV P                   P                  V4      V P                   V&   K-  	  R# u upi )zgRegisters a connection adapter to a prefix.

Adapters are sorted in descending order by prefix length.
N)rj   rG   rM   )r4   r   r   r'   Zkeys_to_mover)   rX   r+   rk   ZSession.mount  sf    
 !(f#'==I=aCFS[4H=IC!%!2!23!7DMM#   Js
   A8A8c           	     sZ    V P                    Uu/ uF  q\        WR 4      bK  	  ppV# u upi ro   )	__attrs__Zgetattr)r4   attrstates   &  r+   __getstate__ZSession.__getstate__*  s/    =A^^L^Twt400^L Ms   (c                sP    VP                  4        F  w  r#\        WV4       K  	  R # ro   )r%   Zsetattr)r4   r   r   Zvaluer   r+   __setstate__ZSession.__setstate__.  s     ;;=KDD& )r0   )rj   rg   r@   rN   r3   rh   rH   ri   rA   r=   rW   r?   )r3   rN   rg   rA   rh   ri   r?   r@   rj   r=   rW   rH   )NNNNNNNTNNNNNN)NNro   )r^   r_   r`   ra   __doc__r   rn   rp   rq   rv   rV   r.   r~   r   r   r   r   r   rQ   rw   r   rI   rk   r   r   rb   rc   rd   re   r+   rf   rf   d  s~     $I;-z)V[z	2	6	3I
=
?5KZV>N
	8' 'r0   rf   c                 s    \        4       # )a>  
Returns a :class:`Session` for context-management.

.. deprecated:: 1.0.0

    This method has been deprecated since version 1.0.0 and is only kept for
    backwards compatibility. New code should use :class:`~requests.sessions.Session`
    to create a session. This may be removed at a future date.

:rtype: Session
)rf   r]   r0   r+   sessionr   3  s     9r0   )<r   r   ZsysZtimeZcollectionsr    Zdatetimer   Z_internal_utilsr   rj   r   rg   r   Zcompatr   r   r   r   rN   r	   r
   r   r   Z
exceptionsr   r   r   r   rh   r   r   Zmodelsr   r   r   r   Zstatus_codesr   Z
structuresr   Zutilsr   r   r   r   r   r   r   r    r!   r"   ZplatformZperf_counterr   r,   r/   r1   rf   r   r]   r0   r+   <module>r      s    
 
  #  - ! ! 9 9   0    +   <<7''OiiO @K < :E Cw) w)tL'" L'^r0   