/usr/lib/python3.9/site-packages/urllib3/__pycache__
NameSizeModeActions
connection.cpython-39.opt-1.pyc133270644editdlrm
connection.cpython-39.pyc133270644editdlrm
connectionpool.cpython-39.opt-1.pyc246710644editdlrm
connectionpool.cpython-39.pyc246710644editdlrm
exceptions.cpython-39.opt-1.pyc115980644editdlrm
exceptions.cpython-39.pyc115980644editdlrm
fields.cpython-39.opt-1.pyc81130644editdlrm
fields.cpython-39.pyc81130644editdlrm
filepost.cpython-39.opt-1.pyc27140644editdlrm
filepost.cpython-39.pyc27140644editdlrm
poolmanager.cpython-39.opt-1.pyc152330644editdlrm
poolmanager.cpython-39.pyc152330644editdlrm
request.cpython-39.opt-1.pyc55770644editdlrm
request.cpython-39.pyc55770644editdlrm
response.cpython-39.opt-1.pyc259890644editdlrm
response.cpython-39.pyc259890644editdlrm
_collections.cpython-39.opt-1.pyc112270644editdlrm
_collections.cpython-39.pyc112270644editdlrm
_version.cpython-39.opt-1.pyc1650644editdlrm
_version.cpython-39.pyc1650644editdlrm
__init__.cpython-39.opt-1.pyc21410644editdlrm
__init__.cpython-39.pyc21410644editdlrm
Edit: /usr/lib/python3.9/site-packages/urllib3/__pycache__/poolmanager.cpython-39.pyc (15233B)
a s>> 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 Né cKs8t ||¡||_t|dd„d�|_t|_t ¡|_dS)NcSs| ¡S©N)Úclose)Úpr,r,r-Ú®óz&PoolManager.__init__..)Z dispose_func)rÚ__init__Úconnection_pool_kwrÚpoolsÚpool_classes_by_schemeÚkey_fn_by_schemer)ÚselfÚ num_poolsrr9r,r,r-r8«s  zPoolManager.__init__cCs|Sr3r,©r=r,r,r-Ú __enter__µszPoolManager.__enter__cCs | ¡dS)NF)Úclear)r=Úexc_typeZexc_valZexc_tbr,r,r-Ú__exit__¸szPoolManager.__exit__cCsb|j|}|dur|j ¡}dD]}| |d¡q |dkrPtD]}| |d¡q>|||fi|¤ŽS)aÎ Create a new :class:`urllib3.connectionpool.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. N)rrÚportr0)r;r9rr'Ú SSL_KEYWORDS)r=rrrDr)Zpool_clsr+Úkwr,r,r-Ú _new_pool½s  zPoolManager._new_poolcCs|j ¡dS)z´ 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:rAr?r,r,r-rAØszPoolManager.clearr0cCsT|s tdƒ‚| |¡}|pd|d<|s:t |d ¡d¡}||d<||d<| |¡S)a¤ Get a :class:`urllib3.connectionpool.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``. If ``pool_kwargs`` is provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed. zNo host specified.r0réPrDr)r Ú_merge_pool_kwargsrr#r Úconnection_from_context)r=rrDrÚ pool_kwargsr)r,r,r-Úconnection_from_hostás   z PoolManager.connection_from_hostcCs:|d ¡}|j |¡}|s$t|ƒ‚||ƒ}|j||d�S)zù Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable. r©r))r r<r#r Úconnection_from_pool_key)r=r)rZpool_key_constructorÚpool_keyr,r,r-rJøs   z#PoolManager.connection_from_contextcCs‚|jj�f|j |¡}|r,|WdƒS|d}|d}|d}|j||||d�}||j|<Wdƒn1st0Y|S)a Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields. NrrrDrM)r:Úlockr#rG)r=rOr)ZpoolrrrDr,r,r-rNs  (z$PoolManager.connection_from_pool_keycCs t|ƒ}|j|j|j|j|d�S)aÖ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` is provided, it is used instead. Note that if a new pool does not need to be created for the request, the provided ``pool_kwargs`` are not used. )rDrrK)rrLrrDr)r=ÚurlrKÚur,r,r-Úconnection_from_urls ÿzPoolManager.connection_from_urlc CsT|j ¡}|rP| ¡D]8\}}|durFz ||=WqNtyBYqN0q|||<q|S)a Merge a dictionary of override values for self.connection_pool_kw. This does not modify self.connection_pool_kw and returns a new dict. Any keys in the override dictionary with a value of ``None`` are removed from the merged dictionary. N)r9rr"ÚKeyError)r=ÚoverrideZbase_pool_kwargsr+Úvaluer,r,r-rI/s    zPoolManager._merge_pool_kwargscCs"|jdurdSt|j|j|jƒ S)z³ Indicates if the proxy requires the complete destination URL in the request. Normally this is only needed when not using an HTTP CONNECT tunnel. NF)ÚproxyrÚ proxy_configr)r=Z parsed_urlr,r,r-Ú!_proxy_requires_url_absolute_formCs   ÿz-PoolManager._proxy_requires_url_absolute_formcCs@|jdus|dkrdS|jjdkr&dStjr<|jjs %s)!rrZrrLrrDrrrYÚurlopenZ request_uriZget_redirect_locationrÚstatusrZ_prepare_for_method_changer#Ú isinstancerZfrom_intZremove_headers_on_redirectZ is_same_hostr%rZiterkeysr r'Z incrementr Zraise_on_redirectZ drain_connÚlogÚinfo) r=ÚmethodrQr[rFrRZconnr^Zredirect_locationr]rÚheaderr,r,r-r_asP         ÿ zPoolManager.urlopen)r2N)N)Nr0N)N)N)T)Ú__name__Ú __module__Ú __qualname__Ú__doc__rWrXr8r@rCrGrArLrJrNrSrIrYrZr_r,r,r,r-rŒs       rcsHeZdZdZd‡fdd„ Zd‡fdd „ Zdd d „Zd‡fd d„ Z‡ZS)ra> Behaves just like :class:`PoolManager`, but sends all requests through the defined proxy, using the CONNECT method for HTTPS URLs. :param proxy_url: The URL of the proxy to be used. :param proxy_headers: A dictionary containing headers that will be sent to the proxy. In case of HTTP they are being sent with each request, while in the HTTPS/CONNECT case they are sent only once. Could be used for proxy authentication. :param proxy_ssl_context: The proxy SSL context is used to establish the TLS connection to the proxy when using HTTPS proxies. :param use_forwarding_for_https: (Defaults to False) If set to True will forward requests to the HTTPS proxy to be made on behalf of the client instead of creating a TLS tunnel via the CONNECT method. **Enabling this flag means that request and response headers and content will be visible from the HTTPS proxy** whereas tunneling keeps request and response headers and content private. IP address, target hostname, SNI, and port are always visible to an HTTPS proxy even when this flag is disabled. Example: >>> proxy = urllib3.ProxyManager('http://localhost:3128/') >>> r1 = proxy.request('GET', 'http://google.com/') >>> r2 = proxy.request('GET', 'http://httpbin.org/') >>> len(proxy.pools) 1 >>> r3 = proxy.request('GET', 'https://httpbin.org/') >>> r4 = proxy.request('GET', 'https://twitter.com/') >>> len(proxy.pools) 3 r2NFc  s¸t|tƒrd|j|j|jf}t|ƒ}|jdvr:t|jƒ‚|jsZt |jd¡} |j | d�}||_ |pfi|_ ||_ t ||ƒ|_|j |d<|j |d<|j|d<tt|ƒj||fi|¤ŽdS)Nz %s://%s:%ir/rH)rDÚ_proxyrZ _proxy_config)rarrrrDrr rr#Ú_replacerWÚ proxy_headersÚproxy_ssl_contextrrXÚsuperrr8) r=Ú proxy_urlr>rrlrmrr9rWrD©Ú __class__r,r-r8Ðs( ý        zProxyManager.__init__r0csD|dkr tt|ƒj||||d�Stt|ƒj|jj|jj|jj|d�S)Nr1)rK)rnrrLrWrrDr)r=rrDrrKrpr,r-rLõs ÿ ÿz!ProxyManager.connection_from_hostcCs0ddi}t|ƒj}|r||d<|r,| |¡|S)z� Sets headers needed by proxies: specifically, the Accept and Host headers. Only sets headers not provided by the user. ZAcceptz*/*ZHost)rÚnetlocÚupdate)r=rQrZheaders_rrr,r,r-Ú_set_proxy_headersÿs  zProxyManager._set_proxy_headersTc sVt|ƒ}t|j|j|jƒs8| d|j¡}| ||¡|d<tt |ƒj ||fd|i|¤ŽS)z@Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.rr[) rrrWrXrr#rrtrnrr_)r=rdrQr[rFrRrrpr,r-r_s zProxyManager.urlopen)r2NNNF)Nr0N)N)T) rfrgrhrir8rLrtr_Ú __classcell__r,r,rpr-r¨s*ù% rcKstfd|i|¤ŽS)Nro)r)rQrFr,r,r-rsr)/Z __future__rÚ collectionsÚ functoolsZloggingÚ _collectionsrrZconnectionpoolrrrÚ exceptionsr r r r r ZpackagesrZpackages.six.moves.urllib.parserZrequestrZ util.proxyrZ util.retryrZutil.urlrÚ__all__Z getLoggerrfrbrEZ _key_fieldsÚ namedtuplerZ_proxy_config_fieldsrr.Úpartialr<r;rrrr,r,r,r-Ús:          6  þ s