
    hw                        S 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  SSKJr  SS	KJrJrJrJr  SS
KJrJrJrJr  SSKJrJrJrJr  SSKJrJr  SSK J!r!J"r"J#r#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3  \Rh                  S:X  a  \Rj                  r6O\R                  r6\4S jr7\4S jr8 " S S5      r9 " S S\95      r:S r;g)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_listwin32c                 <   Uc  U $ U c  U$ [        U[        5      (       a  [        U [        5      (       d  U $ U" [        U5      5      nUR                  [        U 5      5        UR	                  5        VVs/ s H  u  pEUb  M
  UPM     nnnU H  nX7	 M     U$ s  snnf )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)request_settingsession_setting
dict_classmerged_settingkv	none_keyskeys           C/var/www/html/env/lib/python3.13/site-packages/requests/sessions.pymerge_settingr5   =   s      	?G,,OW1U1U @AN//:; "0!5!5!7E!7v1!7IE  	 Fs   5	BBc                     Ub  UR                  S5      / :X  a  U $ U b  U R                  S5      / :X  a  U$ [        XU5      $ )zProperly merges both requests and session hooks.

This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
response)getr5   )request_hookssession_hooksr.   s      r4   merge_hooksr;   [   sM      1 1* = C 1 1* = CzBB    c                   H    \ rS rSrS rS r      S
S jrS rS rS r	S	r
g)SessionRedirectMixinj   c                 ~    UR                   (       a,  UR                  S   nUR                  S5      n[        US5      $ g)z7Receives a Response. Returns a redirect URI or ``None``locationlatin1utf8N)is_redirectheadersencoder   )selfresprA   s      r4   get_redirect_target(SessionRedirectMixin.get_redirect_targetk   s;     ||J/H  x0H#Hf55r<   c                    [        U5      n[        U5      nUR                  UR                  :w  a  gUR                  S:X  a1  UR                  S;   a!  UR                  S:X  a  UR                  S;   a  gUR                  UR                  :g  nUR                  UR                  :g  n[        R
                  " UR                  S5      S4nU(       d!  UR                  U;   a  UR                  U;   a  gU=(       d    U$ )zFDecide whether Authorization header should be removed when redirectingThttp)P   Nhttps)i  NFN)r   hostnameschemeportr   r8   )rG   old_urlnew_url
old_parsed
new_parsedchanged_portchanged_schemedefault_ports           r4   should_strip_auth&SessionRedirectMixin.should_strip_auth   s    g&
g&
*"5"55 ':-!!W,;. "*//9#**j.?.??%))**;*;TBDI</</ -~-r<   Nc	           
   +   8  #    / n
U R                  U5      n[        UR                  5      R                  nU(       Ga'  UR	                  5       nU
R                  U5        U
SS Ul         UR                    [        UR                  5      U R                  :  a  [        SU R                   S3US9eUR!                  5         UR#                  S5      (       a;  [        UR                  5      nS	R%                  ['        UR(                  5      U/5      n[        U5      nUR                  S
:X  a  U(       a  UR+                  US9nOUR                  (       a  UR                  nUR-                  5       nUR.                  (       d   [1        UR                  [3        U5      5      nO[3        U5      n['        U5      Ul        U R5                  X5        UR6                  [8        R:                  [8        R<                  4;  a.  SnU H  nUR>                  RA                  US5        M!     SUl!        UR>                  nURA                  SS5        [E        URF                  X!R                  5        [I        URF                  U RJ                  5        URM                  URF                  5        U RO                  X5      nU RQ                  X5        URR                  SL=(       a    SU;   =(       d    SU;   nU(       a  [U        U5        UnU(       a  Uv   OOU RV                  " U4UUUUUSS.U	D6n[E        U RJ                  XR                  5        U R                  U5      nUv   U(       a  GM&  gg! [        [        [        4 a    UR                  R                  SS9   GN!f = f7f)zBReceives a Response. Returns a generator of Responses or Requests.r   NF)decode_contentz	Exceeded z redirects.)r7   z//: )fragment)Content-LengthzContent-TypeTransfer-EncodingCookier`   ra   )streamtimeoutverifycertproxiesallow_redirects),rI   r   urlr_   copyappendhistorycontentr   r   RuntimeErrorrawreadlenmax_redirectsr   close
startswithjoinr   rP   _replacegeturlnetlocr   r"   rebuild_methodstatus_coder   temporary_redirectpermanent_redirectrE   popbodyr   _cookiesr   cookiesprepare_cookiesrebuild_proxiesrebuild_auth_body_positionr$   send)rG   rH   reqrc   rd   re   rf   rg   yield_requestsadapter_kwargshistri   previous_fragmentprepared_requestparsed_rurlparsedpurged_headersheaderrE   
rewindables                       r4   resolve_redirects&SessionRedirectMixin.resolve_redirects   s%     &&t,$SWW-66"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/Bg/M 
 ,- #C	yy	!#!#$)	 %	 't||5ExxP ..t4
O c )*>M 4U34s1   A&N)M% 5K+N#N%.NNNNc                    UR                   nUR                  nSU;   a.  U R                  UR                  R                  U5      (       a  US	 U R                  (       a  [        U5      OSnUb  UR                  U5        gg)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.
AuthorizationN)rE   ri   rY   request	trust_envr!   prepare_auth)rG   r   r7   rE   ri   new_auths         r4   r   !SessionRedirectMixin.rebuild_auth  s|    
 #**""g%$*@*@  #+
 +

 ( +/..>#&d))(3  r<   c                 F   UR                   n[        UR                  5      R                  n[	        XU R
                  5      nSU;   a  US	  [        XT   5      u  pgUR                  S5      (       d  U(       a  U(       a  [        Xg5      US'   U$ ! [         a    Su  pg NDf = f)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-AuthorizationNNrN   )
rE   r   ri   rP   r#   r   r   KeyErrorrt   r   )rG   r   rg   rE   rP   new_proxiesusernamepasswords           r4   r   $SessionRedirectMixin.rebuild_proxies.  s     #***../66%&6P G+-.	,!2;3F!GH   ))h8-<X-PG)*  	,!+Hh	,s   B B B c                    UR                   nUR                  [        R                  :X  a  US:w  a  SnUR                  [        R                  :X  a  US:w  a  SnUR                  [        R
                  :X  a  US:X  a  SnX1l         g)zrWhen being redirected we may want to change the method of the request
based on certain specs or browser behavior.
HEADGETPOSTN)methodrz   r   	see_otherfoundmoved)rG   r   r7   r   s       r4   ry   #SessionRedirectMixin.rebuild_methodM  su     "(( 5??2v7GF 5;;.6V3CF 5;;.6V3CF"(r<    )FNTNNF)__name__
__module____qualname____firstlineno__rI   rY   r   r   r   ry   __static_attributes__r   r<   r4   r>   r>   j   s7    (.H yv4(>)r<   r>   c                       \ rS rSrSr/ SQrS rS rS rS r	              SS	 jr
S
 rS rS rSS jrSS jrSS jrS rS rS rS rS rS rS rS rSrg)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]>
)rE   r   authrg   hooksparamsre   rf   adaptersrc   r   rr   c                 ^   [        5       U l        S U l        0 U l        [	        5       U l        0 U l        SU l        SU l        S U l	        [        U l        SU l        [        0 5      U l        [        5       U l        U R#                  S[%        5       5        U R#                  S[%        5       5        g )NFTzhttps://zhttp://)r   rE   r   rg   r   r   r   rc   re   rf   r   rr   r   r   r   r   r   mountr   rG   s    r4   __init__Session.__init__  s     '( 	
  #_

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

:{}-

9km,r<   c                     U $ Nr   r   s    r4   	__enter__Session.__enter__  s    r<   c                 $    U R                  5         g r   )rs   )rG   argss     r4   __exit__Session.__exit__  s    

r<   c                    UR                   =(       d    0 n[        U[        R                  5      (       d  [	        U5      n[        [        [        5       U R                   5      U5      nUR                  nU R                  (       a-  U(       d&  U R                  (       d  [        UR                  5      n[        5       nUR                  UR                  R                  5       UR                  UR                  UR                   UR"                  [%        UR&                  U R&                  [(        S9[%        UR*                  U R*                  5      [%        X@R                  5      U[-        UR.                  U R.                  5      S9
  U$ )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   ri   filesdatajsonrE   r   r   r   r   )r   r)   r
   	CookieJarr   r   r   r   r   r!   ri   r   preparer   upperr   r   r   r5   rE   r   r   r;   r   )rG   r   r   merged_cookiesr   ps         r4   prepare_requestSession.prepare_request  s    //'R '9#6#677)'2G '+-t||<g

 ||>>$tyy!'++.D			>>'')--!:M !=tYY/"gmmTZZ8 	 	
 r<   Nc                 .   [        UR                  5       UUUU=(       d    0 UU=(       d    0 UUUS9
nU R                  U5      nU=(       d    0 nU R                  UR                  XX5      nU	U
S.nUR                  U5        U R                  " U40 UD6nU$ )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 long 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   ri   rE   r   r   r   r   r   r   r   )rd   rh   )r   r   r   merge_environment_settingsri   r*   r   )rG   r   ri   r   r   rE   r   r   r   rd   rh   rg   r   rc   re   rf   r   r   prepsettingssend_kwargsrH   s                         r4   r   Session.request  s    ~ <<><R
 ##C(-R22HHgv
 .
 	8$yy--r<   c                 N    UR                  SS5        U R                  " SU40 UD6$ )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
rh   Tr   
setdefaultr   rG   ri   kwargss      r4   r8   Session.getQ  s+     	+T2||E31&11r<   c                 N    UR                  SS5        U R                  " SU40 UD6$ )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
rh   TOPTIONSr   r   s      r4   optionsSession.options\  s+     	+T2||Is5f55r<   c                 N    UR                  SS5        U R                  " SU40 UD6$ )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
rh   Fr   r   r   s      r4   headSession.headg  s+     	+U3||FC2622r<   c                 .    U R                   " SU4X#S.UD6$ )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   )r   r   r   )rG   ri   r   r   r   s        r4   postSession.postr  s     ||FCHdHHHr<   c                 .    U R                   " SU4SU0UD6$ )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
PUTr   r   rG   ri   r   r   s       r4   putSession.put  s     ||E3<T<V<<r<   c                 .    U R                   " SU4SU0UD6$ )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
PATCHr   r   r   s       r4   patchSession.patch  s     ||GS>t>v>>r<   c                 *    U R                   " SU40 UD6$ )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
DELETEr   r   s      r4   deleteSession.delete  s     ||Hc4V44r<   c                    UR                  SU R                  5        UR                  SU R                  5        UR                  SU R                  5        SU;  a#  [	        XR
                  U R                  5      US'   [        U[        5      (       a  [        S5      eUR                  SS5      nUR                  S5      nUR                  nU R                  UR                  S9n[        5       nUR                   " U40 UD6n[        5       U-
  n	[#        U	S	9Ul        ['        S
XX40 UD6nUR(                  (       a>  UR(                   H.  n
[+        U R,                  U
R.                  U
R0                  5        M0     [+        U R,                  XR0                  5        U(       a%  U R2                  " X40 UD6nU V
s/ s H  oPM     nn
O/ nU(       a(  UR5                  SU5        UR                  5       nXl        U(       d$   [7        U R2                  " X4SS0UD65      Ul        U(       d  UR<                    U$ s  sn
f ! [:         a     N&f = f)z9Send a given PreparedRequest.

:rtype: requests.Response
rc   re   rf   rg   z#You can only send PreparedRequests.rh   T)ri   )secondsr7   r   r   )r   rc   re   rf   r#   rg   r   r)   r   
ValueErrorr}   r8   r   get_adapterri   preferred_clockr   r   elapsedr   rl   r   r   r   ro   r   insertnext_nextStopIterationrm   )rG   r   r   rh   rc   r   adapterstartrr   rH   genrl   s                r4   r   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 99		&t||T\\488L " 	t||Wee< ((>v>C(+,tG,GG NN1a AI **1UdUfU II1 -$ ! s   8H7?#H< <
I	I	c                    U R                   (       a  Ub  UR                  S5      OSn[        XS9nUR                  5        H  u  pUR	                  X5        M     USL d  UcN  [
        R                  R                  S5      =(       d(    [
        R                  R                  S5      =(       d    Un[        X R                  5      n[        X0R                  5      n[        X@R                  5      n[        XPR                  5      nX#XES.$ )zF
Check the environment and merge it with some settings.

:rtype: dict
Nno_proxy)r  TREQUESTS_CA_BUNDLECURL_CA_BUNDLE)rg   rc   re   rf   )r   r8   r    r+   r   osenvironr5   rg   rc   re   rf   )
rG   ri   rg   rc   re   rf   r  env_proxiesr0   r1   s
             r4   r   "Session.merge_environment_settings  s     >>292Ew{{:.4H-cEK#))+""1( ,
 ~JJNN#78 zz~~&67   6v{{3v{{3T99-"UUr<   c                     U R                   R                  5        H;  u  p#UR                  5       R                  UR                  5       5      (       d  M9  Us  $    [	        SU< 35      e)zf
Returns the appropriate connection adapter for the given URL.

:rtype: requests.adapters.BaseAdapter
z&No connection adapters were found for )r   r+   lowerrt   r   )rG   ri   prefixr   s       r4   r   Session.get_adapter  sT      $}}224OFyy{%%flln55  5
 DSGLMMr<   c                 f    U R                   R                  5        H  nUR                  5         M     g)z+Closes all adapters and as such the sessionN)r   valuesrs   )rG   r1   s     r4   rs   Session.close  s"    %%'AGGI (r<   c                     X R                   U'   U R                    Vs/ s H  n[        U5      [        U5      :  d  M  UPM!     nnU H+  nU R                   R                  U5      U R                   U'   M-     gs  snf )zgRegisters a connection adapter to a prefix.

Adapters are sorted in descending order by prefix length.
N)r   rq   r}   )rG   r  r   r0   keys_to_mover3   s         r4   r   Session.mount  sd    
 !(f#'==I=aCFS[4H=IC!%!2!23!7DMM#   Js
   A7A7c           	      \    U R                    Vs0 s H  o[        XS 5      _M     nnU$ s  snf r   )	__attrs__getattr)rG   attrstates      r4   __getstate__Session.__getstate__*  s/    =A^^L^Twt400^L Ms   )c                 N    UR                  5        H  u  p#[        XU5        M     g r   )r+   setattr)rG   r  r  values       r4   __setstate__Session.__setstate__.  s     ;;=KDD& )r<   )r   r   rf   r   rE   r   rr   r   rg   rc   r   re   )NNNNNNNTNNNNNNr   r   )r   r   r   r   __doc__r  r   r   r   r   r   r8   r   r   r   r   r   r   r   r   r   rs   r   r  r  r   r   r<   r4   r   r   d  s    $I;-z)^ #[z	2	6	3I
=
?5KZV>N
	8'r<   r   c                      [        5       $ )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
)r   r   r<   r4   sessionr!  3  s     9r<   )<r  r  systimecollectionsr   datetimer   _internal_utilsr   r   r   r   r   compatr	   r
   r   r   r   r   r   r   r   
exceptionsr   r   r   r   r   r   r   modelsr   r   r   r   status_codesr   
structuresr   utilsr   r   r   r    r!   r"   r#   r$   r%   r&   platformperf_counterr   r5   r;   r>   r   r!  r   r<   r4   <module>r/     s    
 
  #  - ! ! 9 9   0    +   <<7''OiiO @K < :E Cw) w)tL'" L'^r<   