Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/requests/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/requests/__pycache__/adapters.cpython-311.pyc

�

�܋faL���dZddlZddlZddlmZmZddlmZddlm	Z
ddlmZmZm
Z
mZddlmZddlmZmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZddlmZddl m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm	Z	m(Z(m)Z)m*Z*mZm+Z+m,Z,mZddl-m.Z.ddl/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8	ddl9m:Z:n#e;$rd�Z:YnwxYwdZ<dZ=dZ>dZ?Gd�d��Z@Gd�de@��ZAdS)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�)�_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� �td���)Nz'Missing dependencies for SOCKS support.)r)�args�kwargss  �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/adapters.pyr)r)<s���E�F�F�F�F�
c�2��eZdZdZ�fd�Z	dd�Zd�Z�xZS)	�BaseAdapterzThe Base Transport Adapterc�H��t�����dS�N)�super�__init__)�self�	__class__s �r-r5zBaseAdapter.__init__Is���
���������r.FNTc��t�)aCSends 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)r6�request�stream�timeout�verify�cert�proxiess       r-�sendzBaseAdapter.sendLs
��""�!r.c��t�)z!Cleans up adapter specific items.r9�r6s r-�closezBaseAdapter.close_s��!�!r.�FNTNN)�__name__�
__module__�__qualname__�__doc__r5rArD�
__classcell__�r7s@r-r1r1Fsh�������$�$������TX�"�"�"�"�&"�"�"�"�"�"�"r.r1c���eZdZdZgd�Zeeeef�fd�	Zd�Z	d�Z
efd�Zd�Zd�Z
d	�Zdd�Zd�Zd
�Zd�Zd�Z	dd�Z�xZS)�HTTPAdaptera�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�4��|tkrtdd���|_ntj|��|_i|_i|_t
�����||_||_	||_
|�|||���dS)NrF)�read��block)�DEFAULT_RETRIESrrN�from_intrO�
proxy_managerr4r5rPrQrR�init_poolmanager)r6�pool_connections�pool_maxsizerN�
pool_blockr7s     �r-r5zHTTPAdapter.__init__�s�����/�)�)�$�Q�U�3�3�3�D���$�~�k�:�:�D��������
��������!1���)���%������.��J��O�O�O�O�Or.c�*���fd��jD��S)Nc�4��i|]}|t�|d����Sr3)�getattr)�.0�attrr6s  �r-�
<dictcomp>z,HTTPAdapter.__getstate__.<locals>.<dictcomp>�s'���K�K�K�D��g�d�D�$�/�/�K�K�Kr.)�	__attrs__rCs`r-�__getstate__zHTTPAdapter.__getstate__�s���K�K�K�K�D�N�K�K�K�Kr.c���i|_i|_|���D]\}}t|||���|�|j|j|j���dS)NrU)rYrO�items�setattrrZrPrQrR)r6�staterb�values    r-�__setstate__zHTTPAdapter.__setstate__�sz�� ������ �;�;�=�=�	'�	'�K�D�%��D�$��&�&�&�&�����"�D�$6�d�>N�	�	
�	
�	
�	
�	
r.c�Z�||_||_||_td|||d�|��|_dS)aInitializes 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�maxsizerVN�)rPrQrRr�poolmanager)r6�connectionsrnrV�pool_kwargss     r-rZzHTTPAdapter.init_poolmanager�sQ��"-���$��� ���&�
�!���
�
��	
�
����r.c	��||jvr|j|}n�|����d��r?t|��\}}t	|f|||j|j|jd�|��x}|j|<n@|�|��}t|f||j|j|jd�|��x}|j|<|S)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�passwordrmrnrV)�
proxy_headersrmrnrV)
rY�lower�
startswithr$r)rPrQrRrwr)r6�proxy�proxy_kwargs�managerrurvrws       r-�proxy_manager_forzHTTPAdapter.proxy_manager_for�s���D�&�&�&��(��/�G�G�
�[�[�]�]�
%�
%�g�
.�
.�	�!2�5�!9�!9��H�h�2C��3�!�!��0��*��&�
3�3��3�3�
�G�d�(��/�/�!�.�.�u�5�5�M�2@��3�+��0��*��&�3�3��
3�3�
�G�d�(��/��r.c� �|����d��r�|r�d}|dur|}|stt��}|rtj�|��std|�����d|_tj�	|��s||_
n||_nd|_d|_
d|_|r�t|t��s|d|_|d|_n||_d|_|jr;tj�|j��std	|j�����|jr=tj�|j��std
|j�����dSdSdS)aAVerify 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.
        �httpsNTzCCould not find a suitable TLS CA certificate bundle, invalid path: �
CERT_REQUIRED�	CERT_NONErrz7Could not find the TLS certificate file, invalid path: z/Could not find the TLS key file, invalid path: )rxryr#r"�os�path�exists�OSError�	cert_reqs�isdir�ca_certs�ca_cert_dir�
isinstancer�	cert_file�key_file)r6�conn�urlr>r?�cert_locs      r-�cert_verifyzHTTPAdapter.cert_verify�s����9�9�;�;�!�!�'�*�*�	$�v�	$��H��T�!�!�!���
H�/�0F�G�G���
�2�7�>�>�(�#;�#;�
��0�%-�0�0����
-�D�N��7�=�=��*�*�
,� (��
�
�#+�� � �(�D�N� �D�M�#�D���	��d�J�/�/�
%�!%�a���� $�Q���
�
�!%��� $��
��~�
�b�g�n�n�T�^�&D�&D�
��6�%)�^�6�6�����}�
�R�W�^�^�D�M�%B�%B�
��U�d�m�U�U����	�	�
�
�
�
r.c���t��}t|dd��|_tt|di����|_t|j��|_||_|jj|_t|j
t��r |j
�d��|_
n|j
|_
t|j||��||_||_|S)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�headerszutf-8)r r`�status_coder!r�r%�encoding�raw�reasonr�r��bytes�decoder�cookiesr;�
connection)r6�req�resp�responses    r-�build_responsezHTTPAdapter.build_response&s����:�:�� '�t�X�t�<�<���/�w�t�Y��/K�/K�L�L���6�h�6F�G�G������"�,�-����c�g�u�%�%�	#��7�>�>�'�2�2�H�L�L��7�H�L�	�x�/��d�;�;�;����"����r.Nc�d�t||��}|r`t|d��}t|��}|jst	d���|�|��}|�|��}n=t|��}|���}|j	�|��}|S)a�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
        �httpzFPlease check proxy URL. It is malformed and could be missing the host.)
r'r&r�hostrr}�connection_from_urlr�geturlrp)r6r�r@rz�	proxy_urlrYr��parseds        r-�get_connectionzHTTPAdapter.get_connectionKs����S�'�*�*���	=�,�U�F�;�;�E�!�%�(�(�I��>�
�%�5����!�2�2�5�9�9�M� �4�4�S�9�9�D�D��c�]�]�F��-�-�/�/�C��#�7�7��<�<�D��r.c��|j���|j���D]}|����dS)z�Disposes of any internal state.

        Currently, this closes the PoolManager and any active ProxyManager,
        which closes any pooled connections.
        N)rp�clearrY�values)r6rzs  r-rDzHTTPAdapter.closehsP��	
���� � � ��'�.�.�0�0�	�	�E��K�K�M�M�M�M�	�	r.c�.�t|j|��}t|j��j}|o|dk}d}|r;t|��j���}|�d��}|j}|r|st|j��}|S)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
        rFrt)r'r�r�schemerxry�path_urlr()	r6r;r@rzr��is_proxied_http_request�using_socks_proxy�proxy_schemer�s	         r-�request_urlzHTTPAdapter.request_urlrs����W�[�'�2�2���'�+�&�&�-��"'�"=�F�g�,=��!���	A�#�E�?�?�1�7�7�9�9�L� ,� 7� 7�� @� @�����"�	-�+<�	-����,�,�C��
r.c��dS)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().
        Nro)r6r;r,s   r-�add_headerszHTTPAdapter.add_headers�s	��	
�r.c�X�i}t|��\}}|rt||��|d<|S)aReturns 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
        zProxy-Authorization)r$r)r6rzr�rurvs     r-rwzHTTPAdapter.proxy_headers�s>����.�u�5�5���(��	Q�-<�X�x�-P�-P�G�)�*��r.FTc
�f�	|�|j|��}n##t$r}t||����d}~wwxYw|�||j||��|�||��}	|�||||||���|jdupd|jv}
t|t��r9	|\}}t||���}nH#t$rtd|�d����wxYwt|t��rnt||���}	|�
|j|	|j|jdddd|j||
�	��}
�n�#t t"f$r}t%||����d}~wt&$r�}t|jt*��r+t|jt,��st/||����t|jt0��rt3||����t|jt4��rt7||����t|jt8��rt;||����t%||����d}~wt<$r}t%||����d}~wt4$r}t7|���d}~wt8t>f$rx}t|t8��rt;||����t|t@��rtC||����t|tD��rtG||�����d}~wwxYw|�$||
��S)
aSends 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
        )r;N)r<r=r>r?r@zContent-Length)�connectrTzInvalid 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�retriesr=�chunked)%r�r�rrr�r�r�r�r�r��tuple�TimeoutSauce�
ValueError�urlopenr�rNr
r�rrr�rr	rr
r�_ProxyErrorr�	_SSLErrorrr�
_HTTPErrorrr�_InvalidHeaderrr�)r6r;r<r=r>r?r@r��er�r�r�rTr��errs               r-rAzHTTPAdapter.send�s���&	1��&�&�w�{�G�<�<�D�D��!�	1�	1�	1��Q��0�0�0�0�����	1����	
����w�{�F�D�9�9�9����w��0�0�����������
	�	
�	
�	
��|�t�+�R�/?�7�?�/R�S���g�u�%�%�	B�
� '�
���&�w�T�B�B�B�����
�
�
� �Q�w�Q�Q�Q����
����
���
.�
.�	B��"�7��A�A�A�G�3	��<�<��~���\����!&� %�$��(��� ���D�D���w�'�	8�	8�	8�!�#�w�7�7�7�7������	6�	6�	6��!�(�$7�8�8�
=�!�!�(�,>�?�?�=�(��G�<�<�<�<��!�(�M�2�2�
5� ��G�4�4�4�4��!�(�K�0�0�
5� ��G�4�4�4�4��!�(�I�.�.�
3��q�'�2�2�2�2�!�!�W�5�5�5�5������	6�	6�	6�!�!�W�5�5�5�5������	 �	 �	 ��Q�-�-�������:�&�		�		�		��!�Y�'�'�
��q�'�2�2�2�2��A�/�0�0�
�!�!�W�5�5�5�5��A�~�.�.�
�#�A�w�7�7�7�7������		�����"�"�7�D�1�1�1sf��
>�9�>�8C�C-�4E�L�E0�0
L�=CI�
L�!I2�2
L�?J�L�"A3L�Lr3rE)rFrGrHrIrd�DEFAULT_POOLSIZErW�DEFAULT_POOLBLOCKr5rerkrZr}r�r�r�rDr�r�rwrArJrKs@r-rMrMdsI���������4���I�*�%�#�$�P�P�P�P�P�P�,L�L�L�
�
�
�+<�
�
�
�
�4$�$�$�L7�7�7�r#�#�#�J����:������:
�
�
����,TX�h2�h2�h2�h2�h2�h2�h2�h2r.rM)BrI�os.pathr��socket�urllib3.exceptionsrrrr�rr�rrr	r
rr�rr
rr��urllib3.poolmanagerrr�urllib3.utilrr�r�urllib3.util.retryr�authr�compatrrr�r�
exceptionsrrrrrrr�modelsr �
structuresr!�utilsr"r#r$r%r&r'r(�urllib3.contrib.socksr)�ImportErrorr�r�rW�DEFAULT_POOL_TIMEOUTr1rMror.r-�<module>r�s2��������
�
�
�
�C�C�C�C�C�C�C�C�6�6�6�6�6�6�>�>�>�>�>�>�������������9�8�8�8�8�8�>�>�>�>�>�>�>�>�4�4�4�4�4�4�;�;�;�;�;�;�;�;�0�0�0�0�0�0�"�"�"�"�"�"�$�$�$�$�$�$�!�!�!�!�!�!�(�(�(�(�(�(�(�(�+�+�+�+�+�+�������������������������������+�+�+�+�+�+�������������������G�7�7�7�7�7�7�7���G�G�G�G�G�G�G�G�G������������"�"�"�"�"�"�"�"�<v2�v2�v2�v2�v2�+�v2�v2�v2�v2�v2s�$B+�+B6�5B6

Hacked By AnonymousFox1.0, Coded By AnonymousFox