
    h;k                     x   S r SSKrSSKrSSKrSSKrSSK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  SSKJr  SSKJrJr  SS	KJr  SS
KJr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#  SSK$J%r%J&r&  SSK'J(r(  SSK)J*r*J+r+JrJ,r,J-r-J.r.JrJ/r/J0r0Jr  SSK1J2r2  SSK3J4r4  SSK5J6r6J7r7J8r8J9r9J:r:J;r;J<r<   SSK=J>r>  \R                  (       a  SSK1JArA  SrBSrCSrDSrE SSKFrF\!" 5       rG\GR                  \7" \65      5                  S!S jrI " S S5      rJ " S S \J5      rKg! \? a    S r> Nrf = f! \? a    SrG N>f = f)"z
requests.adapters
~~~~~~~~~~~~~~~~~

This module contains the transport adapters that Requests uses to define
and maintain connections.
    N)ClosedPoolErrorConnectTimeoutError)	HTTPError)InvalidHeader)LocationValueErrorMaxRetryErrorNewConnectionErrorProtocolError)
ProxyError)ReadTimeoutErrorResponseError)SSLError)PoolManagerproxy_from_url)Timeout)	parse_url)Retry)create_urllib3_context   )_basic_auth_str)
basestringurlparse)extract_cookies_to_jar)
ConnectionErrorConnectTimeoutr   InvalidProxyURLInvalidSchema
InvalidURLr   ReadTimeout
RetryErrorr   )Response)CaseInsensitiveDict)DEFAULT_CA_BUNDLE_PATHextract_zipped_pathsget_auth_from_urlget_encoding_from_headersprepend_scheme_if_neededselect_proxyurldefragauth)SOCKSProxyManagerc                      [        S5      e)Nz'Missing dependencies for SOCKS support.)r   )argskwargss     C/var/www/html/env/lib/python3.13/site-packages/requests/adapters.pyr*   r*   ?   s    EFF    )PreparedRequestF
   c                 R   0 n0 n[        U R                  5      nUR                  R                  5       nUR                  n[        US0 5      n	U	R                  S5      n
[        S L=(       a    U
(       + nSnUSL a  SnOXUSL a  U(       a
  [        US'   OB[        U[        5      (       a-  [        R                  R                  U5      (       d  XS'   OXS'   XS	'   Ub9  [        U[        5      (       a   [        U5      S
:X  a  US   US'   US   US'   OX%S'   UUR                  US.nXE4$ )Nconnection_pool_kwssl_contextCERT_REQUIREDF	CERT_NONETca_certsca_cert_dir	cert_reqs   r   	cert_filer   key_file)schemehostport)r   urlr=   lowerr?   getattrget_preloaded_ssl_context
isinstancestrospathisdirtuplelenhostname)requestverifyclient_certpoolmanagerhost_paramspool_kwargsparsed_request_urlr=   r?   poolmanager_kwargshas_poolmanager_ssl_contextshould_use_default_ssl_contextr9   s                r.   _urllib3_request_contextrW   Z   s:    KK!'++.&&,,.F""D !.BBG"4"8"8"Gd*N3N/N #  I		4:%;M"	FC	 	 ww}}V$$&,
#)/&(k5))c+.>!.C'21~K$&1!nK
# (3$"++K
 ##r/   c                   >   ^  \ rS rSrSrU 4S jr SS jrS rSrU =r	$ )BaseAdapter   zThe Base Transport Adapterc                 "   > [         TU ]  5         g N)super__init__)self	__class__s    r.   r^   BaseAdapter.__init__   s    r/   c                     [         e)a  Sends PreparedRequest object. Returns Response object.

:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
: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 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
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
NotImplementedError)r_   rM   streamtimeoutrN   certproxiess          r.   sendBaseAdapter.send   s
    " "!r/   c                     [         e)z!Cleans up adapter specific items.rc   )r_   s    r.   closeBaseAdapter.close   s    !!r/    FNTNN)
__name__
__module____qualname____firstlineno____doc__r^   ri   rl   __static_attributes____classcell__r`   s   @r.   rY   rY      s!    $ TX"&" "r/   rY   c                      ^  \ rS rSrSr/ SQr\\\\4U 4S jjr	S r
S r\4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S jrSrU =r$ )HTTPAdapter   a?  The built-in HTTP Adapter for urllib3.

Provides a general-case interface for Requests sessions to contact HTTP and
HTTPS urls by implementing the Transport Adapter interface. This class will
usually be created by the :class:`Session <Session>` class under the
covers.

:param pool_connections: The number of urllib3 connection pools to cache.
:param pool_maxsize: The maximum number of connections to save in the pool.
:param max_retries: The maximum number of retries each connection
    should attempt. Note, this applies only to failed DNS lookups, socket
    connections and connection timeouts, never to requests where data has
    made it to the server. By default, Requests does not retry failed
    connections. If you need granular control over the conditions under
    which we retry a request, import urllib3's ``Retry`` class and pass
    that instead.
:param pool_block: Whether the connection pool should block for connections.

Usage::

  >>> import requests
  >>> s = requests.Session()
  >>> a = requests.adapters.HTTPAdapter(max_retries=3)
  >>> s.mount('http://', a)
)max_retriesconfig_pool_connections_pool_maxsize_pool_blockc                    > U[         :X  a  [        SSS9U l        O[        R                  " U5      U l        0 U l        0 U l        [        TU ]  5         Xl        X l	        X@l
        U R                  XUS9  g )Nr   F)readblock)DEFAULT_RETRIESr   r{   from_intr|   proxy_managerr]   r^   r}   r~   r   init_poolmanager)r_   pool_connectionspool_maxsizer{   
pool_blockr`   s        r.   r^   HTTPAdapter.__init__   sm     /)$QU3D$~~k:D!1)%.JOr/   c           	      Z    U R                    Vs0 s H  o[        XS 5      _M     sn$ s  snf r\   )	__attrs__rB   )r_   attrs     r.   __getstate__HTTPAdapter.__getstate__   s(    <@NNKNDgd$//NKKKs   (c                     0 U l         0 U l        UR                  5        H  u  p#[        XU5        M     U R	                  U R
                  U R                  U R                  S9  g )Nr   )r   r|   itemssetattrr   r}   r~   r   )r_   stater   values       r.   __setstate__HTTPAdapter.__setstate__   s]       ;;=KDD& ) 	""D$6$6d>N>N 	 	
r/   c                 P    Xl         X l        X0l        [        SUUUS.UD6U l        g)a  Initializes a urllib3 PoolManager.

This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param connections: The number of urllib3 connection pools to cache.
:param maxsize: The maximum number of connections to save in the pool.
:param block: Block when no free connections are available.
:param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
)	num_poolsmaxsizer   Nrn   )r}   r~   r   r   rP   )r_   connectionsr   r   rR   s        r.   r   HTTPAdapter.init_poolmanager   s;     "-$ & 
!
 	
r/   c           	         XR                   ;   a  U R                   U   nU$ UR                  5       R                  S5      (       aM  [        U5      u  pE[	        U4UUU R
                  U R                  U R                  S.UD6=o0R                   U'   U$ U R                  U5      n[        U4UU R
                  U R                  U R                  S.UD6=o0R                   U'   U$ )a  Return urllib3 ProxyManager for the given proxy.

This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param proxy: The proxy to return a urllib3 ProxyManager for.
:param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
:returns: ProxyManager
:rtype: urllib3.ProxyManager
socks)usernamepasswordr   r   r   )proxy_headersr   r   r   )
r   rA   
startswithr%   r*   r}   r~   r   r   r   )r_   proxyproxy_kwargsmanagerr   r   r   s          r.   proxy_manager_forHTTPAdapter.proxy_manager_for
  s    &&&((/G. - [[]%%g..!25!9H2C3!!00**&&3 3 G((/(  !..u5M2@3+00**&&3 3 G((/ r/   c                 D   UR                  5       R                  S5      (       ay  U(       ar  SUl        USLae  Un[        R                  R                  U5      (       d  [        SU 35      e[        R                  R                  U5      (       d  XQl        OXQl	        OSUl        SUl        SUl	        U(       a  [        U[        5      (       d  US   Ul        US   Ul        OXAl        SUl        UR                  (       aF  [        R                  R                  UR                  5      (       d  [        S	UR                   35      eUR                  (       aG  [        R                  R                  UR                  5      (       d  [        S
UR                   35      eggg)a  Verify a SSL certificate. This method should not be called from user
code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param conn: The urllib3 connection object associated with the cert.
:param url: The requested URL.
:param verify: 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
:param cert: The SSL certificate to verify.
httpsr5   TzCCould not find a suitable TLS CA certificate bundle, invalid path: r6   Nr   r   z7Could not find the TLS certificate file, invalid path: z/Could not find the TLS key file, invalid path: )rA   r   r9   rG   rH   existsOSErrorrI   r7   r8   rE   r   r;   r<   )r_   connr@   rN   rg   cert_locs         r.   cert_verifyHTTPAdapter.cert_verify0  sP    99;!!'**v,DN T!!ww~~h//!))1
4 
 ww}}X..$,M'/$(DN DM#DdJ//!%a $Q!% $~~bggnnT^^&D&D%%)^^$46  }}RWW^^DMM%B%BEdmm_U  &C} r/   c                    [        5       n[        USS5      Ul        [        [        US0 5      5      Ul        [        UR                  5      Ul        X#l        UR                  R                  Ul        [        UR                  [        5      (       a!  UR                  R                  S5      Ul
        OUR                  Ul
        [        UR                  X5        Xl        Xl        U$ )a~  Builds a :class:`Response <requests.Response>` object from a urllib3
response. This should not be called from user code, and is only exposed
for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`

:param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
:param resp: The urllib3 response object.
:rtype: requests.Response
statusNheaderszutf-8)r!   rB   status_coder"   r   r&   encodingrawreasonrE   r@   bytesdecoder   cookiesrM   
connection)r_   reqrespresponses       r.   build_responseHTTPAdapter.build_responseg  s     :  'tXt< /wtY/KL 6h6F6FG",,--cggu%%77>>'2HL77HL 	x//; "r/   c                 .    [        XX0R                  5      $ )a_  Build the PoolKey attributes used by urllib3 to return a connection.

This looks at the PreparedRequest, the user-specified verify value,
and the value of the cert parameter to determine what PoolKey values
to use to select a connection from a given urllib3 Connection Pool.

The SSL related pool key arguments are not consistently set. As of
this writing, use the following to determine what keys may be in that
dictionary:

* If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the
  default Requests SSL Context
* If ``verify`` is ``False``, ``"ssl_context"`` will not be set but
  ``"cert_reqs"`` will be set
* If ``verify`` is a string, (i.e., it is a user-specified trust bundle)
  ``"ca_certs"`` will be set if the string is not a directory recognized
  by :py:func:`os.path.isdir`, otherwise ``"ca_certs_dir"`` will be
  set.
* If ``"cert"`` is specified, ``"cert_file"`` will always be set. If
  ``"cert"`` is a tuple with a second item, ``"key_file"`` will also
  be present

To override these settings, one may subclass this class, call this
method and use the above logic to change parameters as desired. For
example, if one wishes to use a custom :py:class:`ssl.SSLContext` one
must both set ``"ssl_context"`` and based on what else they require,
alter the other keys to ensure the desired behaviour.

:param request:
    The PreparedReqest being sent over the connection.
:type request:
    :class:`~requests.models.PreparedRequest`
:param verify:
    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.
:param cert:
    (optional) Any user-provided SSL certificate for client
    authentication (a.k.a., mTLS). This may be a string (i.e., just
    the path to a file which holds both certificate and key) or a
    tuple of length 2 with the certificate file path and key file
    path.
:returns:
    A tuple of two dictionaries. The first is the "host parameters"
    portion of the Pool Key including scheme, hostname, and port. The
    second is a dictionary of SSLContext related parameters.
)rW   rP   )r_   rM   rN   rg   s       r.   $build_connection_pool_key_attributes0HTTPAdapter.build_connection_pool_key_attributes  s    ` (?O?OPPr/   c                    [        UR                  U5      n U R                  UUU5      u  pgU(       a\  [        US5      n[        U5      n	U	R                  (       d  [        S5      eU R                  U5      n
U
R                  " S0 UDSU0D6nU$ U R                  R                  " S0 UDSU0D6nU$ ! [         a  n[	        XS9eSnAff = f)a  Returns a urllib3 connection for the given request and TLS settings.
This should not be called from user code, and is only exposed for use
when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param request:
    The :class:`PreparedRequest <PreparedRequest>` object to be sent
    over the connection.
:param verify:
    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.
:param proxies:
    (optional) The proxies dictionary to apply to the request.
:param cert:
    (optional) Any user-provided SSL certificate to be used for client
    authentication (a.k.a., mTLS).
:rtype:
    urllib3.ConnectionPool
rM   NhttpFPlease check proxy URL. It is malformed and could be missing the host.rR   rn   )r(   r@   r   
ValueErrorr   r'   r   r>   r   r   connection_from_hostrP   )r_   rM   rN   rh   rg   r   rQ   rR   e	proxy_urlr   r   s               r.   get_connection_with_tls_context+HTTPAdapter.get_connection_with_tls_context  s    ( W[['2	1'+'P'P($K ,UF;E!%(I>>%5  !2259M 55 +6D 	 ##88 +6D )  	1Q00	1s   B2 2
C
<	CC
c                 z   [         R                  " S[        5        [        X5      nU(       aW  [	        US5      n[        U5      nUR                  (       d  [        S5      eU R                  U5      nUR                  U5      nU$ [        U5      nUR                  5       nU R                  R                  U5      nU$ )a  DEPRECATED: Users should move to `get_connection_with_tls_context`
for all subclasses of HTTPAdapter using Requests>=2.32.2.

Returns a urllib3 connection for the given URL. This should not be
called from user code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param url: The URL to connect to.
:param proxies: (optional) A Requests-style dictionary of proxies used on this request.
:rtype: urllib3.ConnectionPool
z`get_connection` has been deprecated in favor of `get_connection_with_tls_context`. Custom HTTPAdapter subclasses will need to migrate for Requests>=2.32.2. Please see https://github.com/psf/requests/pull/6710 for more details.r   r   )warningswarnDeprecationWarningr(   r'   r   r>   r   r   connection_from_urlr   geturlrP   )r_   r@   rh   r   r   r   r   parseds           r.   get_connectionHTTPAdapter.get_connection  s     	N
 	
 S*,UF;E!%(I>>%5  !2259M 44S9D 	 c]F--/C##77<Dr/   c                     U R                   R                  5         U R                  R                  5        H  nUR                  5         M     g)zDisposes of any internal state.

Currently, this closes the PoolManager and any active ProxyManager,
which closes any pooled connections.
N)rP   clearr   values)r_   r   s     r.   rl   HTTPAdapter.close  s8     	 ''..0EKKM 1r/   c                    [        UR                  U5      n[        UR                  5      R                  nU=(       a    US:g  nSnU(       a4  [        U5      R                  R	                  5       nUR                  S5      nUR                  nUR                  S5      (       a  SUR                  S5       3nU(       a  U(       d  [        UR                  5      nU$ )a  Obtain the url to use when making the final request.

If the message is being sent through a HTTP proxy, the full URL has to
be used. Otherwise, we should only use the path portion of the URL.

This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
:rtype: str
r   Fr   z///)	r(   r@   r   r=   rA   r   path_urllstripr)   )	r_   rM   rh   r   r=   is_proxied_http_requestusing_socks_proxyproxy_schemer@   s	            r.   request_urlHTTPAdapter.request_url"  s     W[['2'++&--"'"=Fg,=!#E?11779L , 7 7 @>>$cjjo&'C"+<,C
r/   c                     g)a  Add any headers needed by the connection. As of v2.0 this does
nothing by default, but is left for overriding by users that subclass
the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
:param kwargs: The keyword arguments from the call to send().
Nrn   )r_   rM   r-   s      r.   add_headersHTTPAdapter.add_headersB  s     	r/   c                 N    0 n[        U5      u  p4U(       a  [        X45      US'   U$ )a  Returns a dictionary of the headers to add to any request sent
through a proxy. This works with urllib3 magic to ensure that they are
correctly sent to the proxy, rather than in a tunnelled request if
CONNECT is being used.

This should not be called from user code, and is only exposed for use
when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

:param proxy: The url of the proxy being used for this request.
:rtype: dict
zProxy-Authorization)r%   r   )r_   r   r   r   r   s        r.   r   HTTPAdapter.proxy_headersP  s.     .u5-<X-PG)*r/   c                     U R                  XXeS9nU R                  XqR                  XE5        U R                  X5      n	U R                  UUUUUUS9  UR                  SL =(       d    SUR                  ;   (       + n
[        U[        5      (       a   Uu  p[        XS9nO[        U[        5      (       a  O	[        X3S9n UR                  UR                  U	UR                  UR                  S	S	S	S	U R                  UU
S
9nU RI                  X5      $ ! [         a  n[        XS9eSnAff = f! [         a    [        SU S35      ef = f! [         ["        4 a  n[%        XS9eSnAf[&         a  n[        UR(                  [*        5      (       a(  [        UR(                  [,        5      (       d	  [/        XS9e[        UR(                  [0        5      (       a	  [3        XS9e[        UR(                  [4        5      (       a	  [7        XS9e[        UR(                  [8        5      (       a	  [;        XS9e[%        XS9eSnAf[<         a  n[%        XS9eSnAf[4         a  n[7        U5      eSnAf[8        [>        4 a`  n[        U[8        5      (       a	  [;        XS9e[        U[@        5      (       a	  [C        XS9e[        U[D        5      (       a	  [G        XS9ee SnAff = f)a  Sends PreparedRequest object. Returns Response object.

:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
: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 or urllib3 Timeout object
: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
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
:rtype: requests.Response
)rh   rg   r   N)re   rf   rN   rg   rh   zContent-Length)connectr   zInvalid timeout za. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same value.F)methodr@   bodyr   redirectassert_same_hostpreload_contentdecode_contentretriesrf   chunked)%r   r   r   r   r@   r   r   r   r   rE   rJ   TimeoutSaucer   urlopenr   r{   r
   r   r   r   r   r   r	   r   r   r    _ProxyErrorr   	_SSLErrorr   r   
_HTTPErrorr   r   _InvalidHeaderr   r   )r_   rM   re   rf   rN   rg   rh   r   r   r@   r   r   r   r   errs                  r.   ri   HTTPAdapter.sende  s   &	177 8 D 	{{F9w0 	 	
 ||t+R/?7??/RSgu%% '&wB .."7AG3	<<~~\\!& %$((   Dh ""711g " 	1Q00	1(   &wi 0P Q 2 w' 	8!#77 	6!(($788!!((,>??(<<!((M22 44!((K00 44!((I..q22!!55 	6!!55 	 Q-:& 		!Y''q22A/00!!55A~..#A77		sn   D D-  AE
 
D*	D%%D*-E
K	E##K0CH88K	IKI&&K9AKK)r   r}   r~   r|   r{   rP   r   r\   )NNro   )rp   rq   rr   rs   rt   r   DEFAULT_POOLSIZEr   DEFAULT_POOLBLOCKr^   r   r   r   r   r   r   r   r   r   rl   r   r   r   ri   ru   rv   rw   s   @r.   ry   ry      s    4I *%#$P,L
 +<
4$L5n#J0Qd/b'R@, TXj2 j2r/   ry   )
rM   r0   rN   zbool | str | NonerO   z#typing.Tuple[str, str] | str | NonerP   r   returnz<(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]))Lrt   os.pathrG   sockettypingr   urllib3.exceptionsr   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   urllib3.poolmanagerr   r   urllib3.utilr   r   r   urllib3.util.retryr   urllib3.util.ssl_r   authr   compatr   r   r   r   
exceptionsr   r   r   r   r   r   r    modelsr!   
structuresr"   utilsr#   r$   r%   r&   r'   r(   r)   urllib3.contrib.socksr*   ImportErrorTYPE_CHECKINGr0   r   r   r   DEFAULT_POOL_TIMEOUTsslrD   load_verify_locationsrW   rY   ry   rn   r/   r.   <module>r     sK       C 6 >  9 > 4 ; 0 " $ 4 ! ( +    +  G7 
'    
"350034,$,$,$ 7,$ 	,$
 D,$^" "<h2+ h2U  GGG.  " ""s$   2D "D. 	D+*D+.D98D9