Repository URL to install this package:
Version:
4.0.109 ▾
|
ó èEYc @@ s d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z d d l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d l m Z d d l m Z d d d g Z e j e Z d4 Z d5 Z e j d- e Z d. Z i e j e e d/ 6e j e e d0 6Z! i e d/ 6e d0 6Z" d e f d1 YZ# d e# f d2 YZ$ d3 Z% d S(6 i ( t absolute_importNi ( t RecentlyUsedContainer( t HTTPConnectionPoolt HTTPSConnectionPool( t port_by_scheme( t LocationValueErrort MaxRetryErrort ProxySchemeUnknown( t urljoin( t RequestMethods( t parse_url( t Retryt PoolManagert ProxyManagert proxy_from_urlt key_filet cert_filet cert_reqst ca_certst ssl_versiont ca_cert_dirt ssl_contextt key_schemet key_hostt key_portt key_timeoutt key_retriest key_strictt key_blockt key_source_addresst key_key_filet key_cert_filet key_cert_reqst key_ca_certst key_ssl_versiont key_ca_cert_dirt key_ssl_contextt key_maxsizet key_headerst key__proxyt key__proxy_headerst key_socket_optionst key__socks_optionst key_assert_hostnamet key_assert_fingerprintt PoolKeyc C@ s | j } | d j | d <| d j | d <xG d D]? } | | k r; | | d k r; t | | j | | <q; q; W| j d } | d k r¬ t | | d <n x1 t | j D] } | j | | d | <q¿ Wx* | j D] } | | k rê d | | <qê qê W| | S( s÷ Create a pool key out of a request context dictionary. According to RFC 3986, both the scheme and host are case-insensitive. Therefore, this function normalizes both before constructing the pool key for an HTTPS request. If you wish to change this behaviour, provide alternate callables to ``key_fn_by_scheme``. :param key_class: The class to use when constructing the key. This should be a namedtuple with the ``scheme`` and ``host`` keys at a minimum. :type key_class: namedtuple :param request_context: A dictionary-like object that contain the context for a request. :type request_context: dict :return: A namedtuple that can be used as a connection pool key. :rtype: PoolKey t schemet hostt headerst _proxy_headerst _socks_optionst socket_optionst key_( s headerss _proxy_headersR2 N( t copyt lowert Nonet frozensett itemst gett tuplet listt keyst popt _fields( t key_classt request_contextt contextt keyt socket_optst field( ( sH /home/tvault/.virtenv/lib/python2.7/site-packages/urllib3/poolmanager.pyt _default_key_normalizer9 s !t httpt httpsc B@ s e Z d Z d Z d d d Z d Z d Z d d Z d Z d d d d Z d Z d d Z 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@ sM t j | | | | _ t | d d | _ t | _ t j | _ d S( Nt dispose_funcc S@ s | j S( N( t close( t p( ( sH /home/tvault/.virtenv/lib/python2.7/site-packages/urllib3/poolmanager.pyt <lambda> s ( R t __init__t connection_pool_kwR t poolst pool_classes_by_schemet key_fn_by_schemeR5 ( t selft num_poolsR0 RN ( ( sH /home/tvault/.virtenv/lib/python2.7/site-packages/urllib3/poolmanager.pyRM s c C@ s | S( N( ( RR ( ( sH /home/tvault/.virtenv/lib/python2.7/site-packages/urllib3/poolmanager.pyt __enter__¢ s c C@ s | j t S( N( t cleart False( RR t exc_typet exc_valt exc_tb( ( sH /home/tvault/.virtenv/lib/python2.7/site-packages/urllib3/poolmanager.pyt __exit__¥ s c C@ s | j | } | d k r+ | j j } n x d D] } | j | d q2 W| d k r| x! t D] } | j | d q_ Wn | | | | S( s· Create a new :class:`ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments. If ``request_context`` is provided, it is provided as keyword arguments to the pool class used. 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. R/ t portRG N( s schemes hosts port( RP R7 RN R5 R>