관리-도구
편집 파일: adapters.cpython-311.pyc
� �Re,T � �� � d Z ddlZddlZddlmZmZ ddlmZ ddl m Z ddl mZ ddl mZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2mZmZm3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: n# e;$ r d� Z:Y nw xY wdZ<dZ=dZ>dZ? G d� d e@� � ZA G d!� d"eA� � ZBdS )#z� requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. � N)�PoolManager�proxy_from_url)�HTTPResponse)� parse_url)�Timeout)�Retry)�ClosedPoolError)�ConnectTimeoutError)� HTTPError)� MaxRetryError)�NewConnectionError)� ProxyError)� ProtocolError)�ReadTimeoutError)�SSLError)� ResponseError)�LocationValueError� )�Response)�urlparse� basestring)�DEFAULT_CA_BUNDLE_PATH�extract_zipped_paths�get_encoding_from_headers�prepend_scheme_if_needed�get_auth_from_url� urldefragauth�select_proxy)�CaseInsensitiveDict)�extract_cookies_to_jar) �ConnectionError�ConnectTimeout�ReadTimeoutr r � RetryError� InvalidSchema�InvalidProxyURL� InvalidURL)�_basic_auth_str)�SOCKSProxyManagerc � � t d� � �)Nz'Missing dependencies for SOCKS support.)r% )�args�kwargss ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/requests/adapters.pyr) r) . s � ��E�F�F�F� F� c �4 � � e Zd ZdZ� fd�Z dd�Zd� Z� xZS ) �BaseAdapterzThe Base Transport Adapterc �V �� t t | � � � � � d S �N)�superr1 �__init__)�self� __class__s �r- r5 zBaseAdapter.__init__: s% �� � �k�4� � �)�)�+�+�+�+�+r. FNTc � � t �)aC 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)r6 �request�stream�timeout�verify�cert�proxiess r- �sendzBaseAdapter.send= s � � "�!r. c � � t �)z!Cleans up adapter specific items.r9 �r6 s r- �closezBaseAdapter.closeO s � �!�!r. �FNTNN)�__name__� __module__�__qualname__�__doc__r5 rA rD � __classcell__�r7 s @r- r1 r1 7 sk �� � � � � �$�$�,� ,� ,� ,� ,� @D� $�"� "� "� "�$"� "� "� "� "� "� "r. r1 c � � � e Zd ZdZg d�Zeeeef� fd� Zd� Z d� Z efd�Zd� Zd� Z d � Zdd�Zd� Zd � Zd� Zd� Zdd�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 �B �� |t k rt dd�� � | _ nt j |� � | _ i | _ i | _ t t | � � � � � || _ || _ || _ | � |||�� � d S )Nr F)�read��block) �DEFAULT_RETRIESr rN �from_intrO � proxy_managerr4 rM r5 rP rQ rR �init_poolmanager)r6 �pool_connections�pool_maxsizerN � pool_blockr7 s �r- r5 zHTTPAdapter.__init__q s� �� � �/�)�)�$�Q�U�3�3�3�D���$�~�k�:�:�D�������� �k�4� � �)�)�+�+�+�!1���)���%������.��J��O�O�O�O�Or. c �* � � � fd�� j D � � S )Nc �4 �� i | ]}|t �|d � � ��S r3 )�getattr)�.0�attrr6 s �r- � <dictcomp>z,HTTPAdapter.__getstate__.<locals>.<dictcomp>� s'