Files
wg-backend-django/acer-env/lib/python3.10/site-packages/urllib3/__pycache__/poolmanager.cpython-310.pyc

225 lines
15 KiB
Plaintext
Raw Normal View History

2022-11-30 15:58:16 +07:00
o
<00>ԄcJM<00>@s6ddlmZddlZddlZddlZddlmZddlmZm Z m
Z
ddl m Z m Z mZmZmZddlmZddlmZdd lmZdd
lmZdd lmZdd lmZgd <0A>Ze<04>e<1F>Z dZ!dZ"e<02>#de"<22>Z$dZ%e<02>#de%<25>Z&dd<14>Z'e<03>(e'e$<24>e<03>(e'e$<24>d<15>Z)ee d<15>Z*Gdd<17>de<16>Z+Gdd<19>de+<2B>Z,dd<1B>Z-dS)<1C>)<01>absolute_importN<74>)<01>RecentlyUsedContainer)<03>HTTPConnectionPool<6F>HTTPSConnectionPool<6F>port_by_scheme)<05>LocationValueError<6F> MaxRetryError<6F>ProxySchemeUnknown<77>ProxySchemeUnsupported<65>URLSchemeUnknown)<01>six)<01>urljoin)<01>RequestMethods)<01>connection_requires_http_tunnel)<01>Retry)<01> parse_url)<03> PoolManager<65> ProxyManager<65>proxy_from_url) <09>key_file<6C> cert_file<6C> cert_reqs<71>ca_certs<74> ssl_version<6F> ca_cert_dir<69> ssl_context<78> key_password<72>server_hostname)<1A>
key_scheme<EFBFBD>key_host<73>key_port<72> key_timeout<75> key_retries<65>
key_strict<EFBFBD> key_block<63>key_source_address<73> key_key_file<6C>key_key_password<72> key_cert_file<6C> key_cert_reqs<71> key_ca_certs<74>key_ssl_version<6F>key_ca_cert_dir<69>key_ssl_context<78> key_maxsize<7A> key_headers<72>
key__proxy<EFBFBD>key__proxy_headers<72>key__proxy_config<69>key_socket_options<6E>key__socks_options<6E>key_assert_hostname<6D>key_assert_fingerprint<6E>key_server_hostname<6D>PoolKey)r<00>use_forwarding_for_https<70> ProxyConfigcCs<>|<01><00>}|d<00><01>|d<|d<00><01>|d<dD]}||vr,||dur,t||<00><03><00>||<q|<02>d<05>}|dur<t|<04>|d<t|<02><07><00>D] }|<02>|<03>|d|<qB|j D]
}||vr[d||<qQ|di|<02><01>S)a<>
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
<20>scheme<6D>host)<03>headers<72>_proxy_headers<72>_socks_optionsN<73>socket_options<6E>key_<79>)
<EFBFBD>copy<70>lower<65> frozenset<65>items<6D>get<65>tuple<6C>list<73>keys<79>pop<6F>_fields)<06> key_class<73>request_context<78>context<78>key<65> socket_opts<74>fieldrCrC<00>f/home/infidel/Sync/Project/ocp-wg-backend/acer-env/lib/python3.10/site-packages/urllib3/poolmanager.py<70>_default_key_normalizerOs"<02>
 
<02>rU<00><02>http<74>httpsc@s<>eZdZdZdZdZd dd<05>Zdd<07>Zdd <09>Zd!d
d <0B>Z d d <0A>Z
d"dd<10>Z dd<12>Z d!dd<14>Z d!dd<16>Zdd<18>Zdd<1A>Zdd<1C>Zd#dd<1F>ZdS)$ra$
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
N<>
cKs8t<00>||<02>||_t|dd<02>d<03>|_t|_t<06><07>|_dS)NcSs|<00><00>S<00>N)<01>close)<01>prCrCrT<00><lambda><3E>sz&PoolManager.__init__.<locals>.<lambda>)<01> dispose_func)r<00>__init__<5F>connection_pool_kwr<00>pools<6C>pool_classes_by_scheme<6D>key_fn_by_schemerD)<04>self<6C> num_poolsr>r`rCrCrTr_<00>s
zPoolManager.__init__cCs|SrZrC<00>rdrCrCrT<00> __enter__<5F>szPoolManager.__enter__cCs |<00><00>dS)NF)<01>clear)rd<00>exc_type<70>exc_val<61>exc_tbrCrCrT<00>__exit__<5F>szPoolManager.__exit__cCsb|j|}|dur|j<01><02>}dD]}|<04>|d<01>q|dkr(tD]}|<04>|d<01>q|||fi|<04><01>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)r<r=<00>portrW)rbr`rDrL<00> SSL_KEYWORDS)rdr<r=rmrO<00>pool_clsrQ<00>kwrCrCrT<00> _new_pool<6F>s

zPoolManager._new_poolcCs|j<00><01>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)rarhrfrCrCrTrh<00>szPoolManager.clearrWcCsT|std<01><01>|<00>|<04>}|pd|d<|st<02>|d<00><04>d<04>}||d<||d<|<00>|<05>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.rWr<<00>Prmr=)r<00>_merge_pool_kwargsrrHrE<00>connection_from_context)rdr=rmr<<00> pool_kwargsrOrCrCrT<00>connection_from_host<73>s 
 
z PoolManager.connection_from_hostcCs:|d<00><00>}|j<01>|<02>}|st|<02><01>||<01>}|j||d<02>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<<00>rO)rErcrHr <00>connection_from_pool_key)rdrOr<<00>pool_key_constructor<6F>pool_keyrCrCrTrt<00>s  z#PoolManager.connection_from_contextcCs<>|jj<01>4|j<00>|<01>}|r|Wd<00>S|d}|d}|d}|j||||d<05>}||j|<Wd<00>|S1s;wY|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.
Nr<r=rmrw)ra<00>lockrHrq)rdrzrO<00>poolr<r=rmrCrCrTrxs
 <10> 
<EFBFBD><10>z$PoolManager.connection_from_pool_keycCs t|<01>}|j|j|j|j|d<01>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.
)rmr<ru)rrvr=rmr<)rd<00>urlru<00>urCrCrT<00>connection_from_urls <06>zPoolManager.connection_from_urlc CsR|j<00><01>}|r'|<01><02>D]\}}|dur"z||=Wq ty!Yq w|||<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)r`rDrG<00>KeyError)rd<00>override<64>base_pool_kwargsrQ<00>valuerCrCrTrs/s

 <02>
zPoolManager._merge_pool_kwargscCs"|jdurdSt|j|j|j<03> 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)<04>proxyr<00> proxy_configr<)rd<00>
parsed_urlrCrCrT<00>!_proxy_requires_url_absolute_formCs
 <06>z-PoolManager._proxy_requires_url_absolute_formcCsD|jdus |dkr dS|jjdkrdStjr|jjs td<03><01>dSdS)z<>
Validates that were not attempting to do TLS in TLS connections on
Python2 or with unsupported SSL implementations.
NrXzfContacting HTTPS destinations through HTTPS proxies 'via CONNECT tunnels' is not supported in Python 2)r<>r<r <00>PY2r<32>r:r )rd<00>
url_schemerCrCrT<00>$_validate_proxy_scheme_url_selectionPs <04><08>z0PoolManager._validate_proxy_scheme_url_selectionTc Ks<>t|<02>}|<00>|j<02>|j|j|j|jd<01>}d|d<d|d<d|vr(|j<06><07>|d<|<00>|<05>r8|j ||fi|<04><01>}n |j ||j
fi|<04><01>}|oH|<07> <0B>}|sM|St ||<08>}|j dkrYd}|<04>d<08>} t| t<10>sjtj| |d <09>} | jr<>|<06>|<08>s<>tt<15>|d<00><01>}
|
D]} | <0B><17>| jvr<>|d<00>| d
<EFBFBD>q}z | j||||d <0B>} Wnty<>| jr<>|<07><1C><00>|YSw| |d<||d<t<1D>d ||<08>|<07><1C>|j ||fi|<04><01>S) aN
Same as :meth:`urllib3.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.
The given ``url`` parameter must be absolute, such that an appropriate
:class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.
)rmr<F<>assert_same_host<73>redirectr>i/<00>GET<45>retries)r<>N)<02>response<73>_poolzRedirecting %s -> %s)rr<>r<rvr=rmr>rDr<><00>urlopen<65> request_uri<72>get_redirect_locationr<00>statusrH<00>
isinstancer<00>from_int<6E>remove_headers_on_redirect<63> is_same_hostrJr <00>iterkeysrErL<00> incrementr <00>raise_on_redirect<63>
drain_conn<EFBFBD>log<6F>info) rd<00>methodr}r<>rpr~<00>connr<6E><00>redirect_locationr<6E>r><00>headerrCrCrTr<>asP 
 




<04><02> <02>zPoolManager.urlopen)rYNrZ<00>NrWN<>T)<13>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r<5F>r<>r_rgrlrqrhrvrtrxrrsr<>r<>r<>rCrCrCrTr<00>s"





 rcsReZdZdZ     d<0F>fdd<06> Zd<10>fdd <09> Zdd
d <0B>Zd<12>fd d<0E> Z<07>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
rYNFc
 s<>t|t<01>rd|j|j|jf}t|<01>}|jdvrt|j<02><01>|js-t<07>|jd<03>} |j | d<04>}||_
|p3i|_ ||_ t ||<06>|_|j
|d<|j |d<|j|d<tt|<00>j||fi|<07><01>dS)Nz
%s://%s:%irVrr)rm<00>_proxyr?<00> _proxy_config)r<>rr<r=rmrr
rrH<00>_replacer<65><00> proxy_headers<72>proxy_ssl_contextr;r<><00>superrr_)
rd<00> proxy_urlrer>r<>r<>r:r`r<>rm<00><01> __class__rCrTr_<00>s(
<06>

 
 


zProxyManager.__init__rWcsD|dkrtt|<00>j||||d<02>Stt|<00>j|jj|jj|jj|d<02>S)NrX)ru)r<>rrvr<>r=rmr<)rdr=rmr<rur<>rCrTrv<00>s
<06>
<06>z!ProxyManager.connection_from_hostcCs0ddi}t|<01>j}|r||d<|r|<03>|<02>|S)z<>
Sets headers needed by proxies: specifically, the Accept and Host
headers. Only sets headers not provided by the user.
<20>Acceptz*/*<2A>Host)r<00>netloc<6F>update)rdr}r><00>headers_r<5F>rCrCrT<00>_set_proxy_headers<72>s

zProxyManager._set_proxy_headersTc sVt|<02>}t|j|j|j<04>s|<04>d|j<06>}|<00>||<06>|d<tt |<00>j
||fd|i|<04><01>S)z@Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.r>r<>) rrr<>r<>r<rHr>r<>r<>rr<>)rdr<>r}r<>rpr~r>r<>rCrTr<> s
zProxyManager.urlopen)rYNNNFr<46>rZr<>) r<>r<>r<>r<>r_rvr<>r<><00> __classcell__rCrCr<>rTr<00>s*<0E>%
rcKstdd|i|<01><01>S)Nr<4E>rC)r)r}rprCrCrTrsr).<2E>
__future__r<00> collections<6E> functools<6C>logging<6E> _collectionsr<00>connectionpoolrrr<00>
exceptionsrr r
r r <00>packagesr <00>packages.six.moves.urllib.parser<00>requestr<00>
util.proxyr<00>
util.retryr<00>util.urlr<00>__all__<5F> getLoggerr<72>r<>rn<00> _key_fields<64>
namedtupler9<00>_proxy_config_fieldsr;rU<00>partialrcrbrrrrCrCrCrT<00><module>s<        
  
6
<06>
 s