AlkantarClanX12
Current Path : /lib/python3.6/site-packages/urllib3/__pycache__/ |
Current File : //lib/python3.6/site-packages/urllib3/__pycache__/connectionpool.cpython-36.pyc |
3 h��f@� � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlmZm Z d dlZddlmZm Z mZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ dd lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z& dd l'm(Z( ddl)m*Z* ddl+m,Z, dd l-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z: ddl;m<Z< ej=j>Z>ej?e@�ZAeB� ZCG dd� deB�ZDejEejFhZGG dd� deDe*�ZHG dd� deH�ZIdd� ZJdd� ZKdS )� )�absolute_importN)�error�timeout� ) �ClosedPoolError� ProtocolError�EmptyPoolError�HeaderParsingError�HostChangedError�LocationValueError� MaxRetryError� ProxyError�ReadTimeoutError�SSLError�TimeoutError�InsecureRequestWarning�NewConnectionError)�CertificateError)�six)�queue)�port_by_scheme�DummyConnection�HTTPConnection�HTTPSConnection�VerifiedHTTPSConnection� HTTPException�BaseSSLError)�HTTPHeaderDict)�RequestMethods)�HTTPResponse)�is_connection_dropped)�set_file_position)�assert_header_parsing)�Retry)�Timeout)�get_host�Url�NORMALIZABLE_SCHEMES)� LifoQueuec @ sB e Zd ZdZdZeZd dd�Zdd� Zdd� Z d d � Z dd� ZdS )�ConnectionPoolzz Base class for all connection pools, such as :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. Nc C s. |st d��t|| j�| _|j� | _|| _d S )NzNo host specified.)r � _ipv6_host�scheme�host�lower�_proxy_host�port)�selfr, r/ � r1 �$/usr/lib/python3.6/connectionpool.py�__init__A s zConnectionPool.__init__c C s dt | �j| j| jf S )Nz%s(host=%r, port=%r))�type�__name__r, r/ )r0 r1 r1 r2 �__str__I s zConnectionPool.__str__c C s | S )Nr1 )r0 r1 r1 r2 � __enter__M s zConnectionPool.__enter__c C s | j � dS )NF)�close)r0 �exc_typeZexc_valZexc_tbr1 r1 r2 �__exit__P s zConnectionPool.__exit__c C s dS )zD Close all pooled connections and disable the pool. Nr1 )r0 r1 r1 r2 r8 U s zConnectionPool.close)N)r5 � __module__�__qualname__�__doc__r+ r( �QueueClsr3 r6 r7 r: r8 r1 r1 r1 r2 r) 8 s r) c @ s� e Zd ZdZdZeZeZdde j ddddddf dd�Zdd � Zd!d d�Z dd � Zdd� Zdd� Zdd� Zdd� Zedfdd�Zdd� Zdd� Zdd� Zdddddeddddf dd �ZdS )"�HTTPConnectionPoolaN Thread-safe connection pool for one host. :param host: Host used for this HTTP Connection (e.g. "localhost"), passed into :class:`httplib.HTTPConnection`. :param port: Port used for this HTTP Connection (None is equivalent to 80), passed into :class:`httplib.HTTPConnection`. :param strict: Causes BadStatusLine to be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line, passed into :class:`httplib.HTTPConnection`. .. note:: Only works in Python 2. This parameter is ignored in Python 3. :param timeout: Socket timeout in seconds for each individual connection. This can be a float or integer, which sets the timeout for the HTTP request, or an instance of :class:`urllib3.util.Timeout` which gives you more fine-grained control over request timeouts. After the constructor has been parsed, this is always a `urllib3.util.Timeout` object. :param maxsize: Number of connections to save that can be reused. More than 1 is useful in multithreaded situations. If ``block`` is set to False, more connections will be created but they will not be saved once they've been used. :param block: If set to True, no more than ``maxsize`` connections will be used at a time. When no free connections are available, the call will block until a connection has been released. This is a useful side effect for particular multithreaded situations where one does not want to use more than maxsize connections per host to prevent flooding. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param retries: Retry configuration to use by default with requests in this pool. :param _proxy: Parsed proxy URL, should not be used directly, instead, see :class:`urllib3.connectionpool.ProxyManager`" :param _proxy_headers: A dictionary with proxy headers, should not be used directly, instead, see :class:`urllib3.connectionpool.ProxyManager`" :param \**conn_kw: Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`, :class:`urllib3.connection.HTTPSConnection` instances. �httpNFr c K s� t j| ||� tj| |� || _t|t�s4tj|�}|d krBtj}|| _ || _ | j|�| _|| _ | | _| pli | _xt|�D ]}| jjd � qzW d| _d| _|| _| jr�| jjdg � d S )Nr Zsocket_options)r) r3 r �strict� isinstancer$ � from_floatr# ZDEFAULTr �retriesr>