Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
usr
/
lib
/
python2.7
/
site-packages
/
botocore
/
vendored
/
requests
/
packages
/
urllib3
/
File Content:
poolmanager.pyc
� ?��Xc @ s1 d d l Z y d d l m Z Wn! e k rC d d l m Z n Xd d l m Z d d l m Z m Z d d l m Z d d l m Z m Z d d l m Z d d l m Z d d l m Z d d d g Z i e d 6e d 6Z e j e � Z d Z d e f d � � YZ d e f d � � YZ d � Z d S( i����N( t urljoini ( t RecentlyUsedContainer( t HTTPConnectionPoolt HTTPSConnectionPool( t port_by_scheme( t LocationValueErrort MaxRetryError( t RequestMethods( t parse_url( t Retryt PoolManagert ProxyManagert proxy_from_urlt httpt httpst key_filet cert_filet cert_reqst ca_certst ssl_versionc B sk e Z d Z d Z d d d � Z d � Z d � Z d � Z d � Z d d d � Z d � Z e d � Z RS( s$ Allows for arbitrary requests while transparently keeping track of necessary connection pools for you. :param num_pools: Number of connection pools to cache before discarding the least recently used pool. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param \**connection_pool_kw: Additional parameters are used to create fresh :class:`urllib3.connectionpool.ConnectionPool` instances. Example:: >>> manager = PoolManager(num_pools=2) >>> r = manager.request('GET', 'http://google.com/') >>> r = manager.request('GET', 'http://google.com/mail') >>> r = manager.request('GET', 'http://yahoo.com/') >>> len(manager.pools) 2 i c K s5 t j | | � | | _ t | d d � �| _ d S( Nt dispose_funcc S s | j � S( N( t close( t p( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt <lambda>A s ( R t __init__t connection_pool_kwR t pools( t selft num_poolst headersR ( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyR = s c C s | S( N( ( R ( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt __enter__C s c C s | j � t S( N( t cleart False( R t exc_typet exc_valt exc_tb( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt __exit__F s c C sb t | } | j } | d k rR | j j � } x! t D] } | j | d � q5 Wn | | | | � S( s Create a new :class:`ConnectionPool` based on host, port and scheme. This method is used to actually create the connection pools handed out by :meth:`connection_from_url` and companion methods. It is intended to be overridden for customization. R N( t pool_classes_by_schemeR t copyt SSL_KEYWORDSt popt None( R t schemet hostt portt pool_clst kwargst kw( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt _new_poolK s c C s | j j � d S( s� Empty our store of pools and direct them all to close. This will not affect in-flight connections, but they will not be re-used after completion. N( R R ( R ( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyR \ s R c C s� | s t d � � n | p d } | p6 t j | d � } | | | f } | j j �C | j j | � } | rq | S| j | | | � } | | j | <Wd QX| S( s� Get a :class:`ConnectionPool` based on the host, port, and scheme. If ``port`` isn't given, it will be derived from the ``scheme`` using ``urllib3.connectionpool.port_by_scheme``. s No host specified.R iP N( R R t getR t lockR0 ( R R+ R, R* t pool_keyt pool( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt connection_from_hoste s c C s. t | � } | j | j d | j d | j �S( s* Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor. Additional parameters are taken from the :class:`.PoolManager` constructor. R, R* ( R R5 R+ R, R* ( R t urlt u( ( sY /tmp/pip-build-uEGWVr/botocore/botocore/vendored/requests/packages/urllib3/poolmanager.pyt connection_from_url� s c K s� t | � } | j | j d | j d | j �} t | d <t | d <d | k r` | j | d <n | j d k r� | j d k r� | j | | | � } n | j | | j | � } | o� | j � } | s� | St | | � } | j d k r� d } n | j d � } t | t � s't j | d | �} n y"