Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
odigos / etc / odigos-vmagent / instrumentations / python / urllib3 / __pycache__ / poolmanager.cpython-311.pyc
Size: Mime:
§

ÞEqfNãó¾—ddlmZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZddlm
Z
mZmZmZmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZgd
¢Zeje ¦«Z!dZ"dZ#ej$de#¦«Z%dZ&ej$de&¦«Z'd„Z(ej)e(e%¦«ej)e(e%¦«dœZ*e	e
dœZ+Gd„de¦«Z,Gd„de,¦«Z-d„Z.dS)é)Úabsolute_importNé)ÚHTTPHeaderDictÚRecentlyUsedContainer)ÚHTTPConnectionPoolÚHTTPSConnectionPoolÚport_by_scheme)ÚLocationValueErrorÚ
MaxRetryErrorÚProxySchemeUnknownÚProxySchemeUnsupportedÚURLSchemeUnknown)Úsix)Úurljoin)ÚRequestMethods)Úconnection_requires_http_tunnel)ÚRetry)Ú	parse_url)ÚPoolManagerÚProxyManagerÚproxy_from_url)	Úkey_fileÚ	cert_fileÚ	cert_reqsÚca_certsÚssl_versionÚca_cert_dirÚssl_contextÚkey_passwordÚserver_hostname)Ú
key_schemeÚkey_hostÚkey_portÚkey_timeoutÚkey_retriesÚ
key_strictÚ	key_blockÚkey_source_addressÚkey_key_fileÚkey_key_passwordÚ
key_cert_fileÚ
key_cert_reqsÚkey_ca_certsÚkey_ssl_versionÚkey_ca_cert_dirÚkey_ssl_contextÚkey_maxsizeÚkey_headersÚ
key__proxyÚkey__proxy_headersÚkey__proxy_configÚkey_socket_optionsÚkey__socks_optionsÚkey_assert_hostnameÚkey_assert_fingerprintÚkey_server_hostnameÚPoolKey)rÚuse_forwarding_for_httpsÚProxyConfigcó—| ¦«}|d ¦«|d<|d ¦«|d<dD]8}||vr2||*t|| ¦«¦«||<Œ9| d¦«}|t|¦«|d<t
| ¦«¦«D]}| |¦«|d|z<Œ|j	D]}||vrd||<Œ|di|¤Ž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
    ÚschemeÚhost)ÚheadersÚ_proxy_headersÚ_socks_optionsNÚsocket_optionsÚkey_©)
ÚcopyÚlowerÚ	frozensetÚitemsÚgetÚtupleÚlistÚkeysÚpopÚ_fields)Ú	key_classÚrequest_contextÚcontextÚkeyÚsocket_optsÚfields      ú:/tmp/pip-target-asg8frr5/lib/python/urllib3/poolmanager.pyÚ_default_key_normalizerrXOs8€ð*×"Ò"Ñ$Ô$€GØ Ô)×/Ò/Ñ1Ô1€GˆHÑØ˜f”o×+Ò+Ñ-Ô-€GˆFOð?ð;ð;ˆØ'ˆ>ˆ>˜g cœlÐ6Ý$ W¨S¤\×%7Ò%7Ñ%9Ô%9Ñ:Ô:ˆGC‰Løð—+’+Ð.Ñ/Ô/€KØÐÝ$)¨+Ñ$6Ô$6ˆÐ Ñ!õG—L’L‘N”NÑ#Ô#ð1ð1ˆØ '§¢¨CÑ 0Ô 0ˆ˜‘ÑÐðÔ"ð"ð"ˆØ˜ÐÐØ!ˆGE‰Nøàˆ9ÐАwÐÐÐó©ÚhttpÚhttpscót—eZdZdZdZdZdd„Zd„Zd„Zdd„Z	d„Z
dd
„Zd„Zdd„Z
dd
„Zd„Zd„Zd„Zdd„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é
cóº—tj||¦«||_t|¦«|_t
|_t ¦«|_dS©N)rÚ__init__Úconnection_pool_kwrÚpoolsÚpool_classes_by_schemeÚkey_fn_by_schemerG)ÚselfÚ	num_poolsrArbs    rWrazPoolManager.__init__«sP€ÝÔ  gÑ.Ô.Ð.Ø"4ˆÔÝ*¨9Ñ5Ô5ˆŒ
õ'=ˆÔ#Ý 0× 5Ò 5Ñ 7Ô 7ˆÔÐÐrYcó—|Sr`rF©rfs rWÚ	__enter__zPoolManager.__enter__µs€ØˆrYcó.—| ¦«dS)NF)Úclear)rfÚexc_typeÚexc_valÚexc_tbs    rWÚ__exit__zPoolManager.__exit__¸s€Ø
Š
‰ŒˆàˆurYcóè—|j|}|€|j ¦«}dD]}| |d¦«Œ|dkr tD]}| |d¦«Œ|||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)r?r@Úportr[)rdrbrGrOÚSSL_KEYWORDS)rfr?r@rrrRÚpool_clsrTÚkws        rWÚ	_new_poolzPoolManager._new_pool½s¢€ðÔ.¨vÔ6ˆØÐ"Ø"Ô5×:Ò:Ñ<Ô<ˆOð.ð	+ð	+ˆCØ×Ò  TÑ*Ô*Ð*Ð*àVÒÐÝ"ð
.ð
.Ø×#Ò# B¨Ñ-Ô-Ð-Ð-àˆx˜˜dÐ6Ð6 oÐ6Ð6Ð6rYcó8—|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)rcrlris rWrlzPoolManager.clearØs€ð	
Œ
×ÒÑÔÐÐÐrYr[cóø—|std¦«‚| |¦«}|pd|d<|s-tj|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.r[r?éPrrr@)r
Ú_merge_pool_kwargsr	rKrHÚconnection_from_context)rfr@rrr?Úpool_kwargsrRs      rWÚconnection_from_hostz PoolManager.connection_from_hostás‘€ðð	;Ý$Ð%9Ñ:Ô:Ð:à×1Ò1°+Ñ>Ô>ˆØ$*Ð$4¨fˆ˜Ñ!Øð	MÝ!Ô% o°hÔ&?×&EÒ&EÑ&GÔ&GÈÑLÔLˆDØ"&ˆ˜ÑØ"&ˆ˜Ñà×+Ò+¨OÑ<Ô<Ð<rYcóЗ|d ¦«}|j |¦«}|st|¦«‚||¦«}| ||¬¦«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?©rR)rHrerKrÚconnection_from_pool_key)rfrRr?Úpool_key_constructorÚpool_keys     rWr{z#PoolManager.connection_from_contextøsp€ð! Ô*×0Ò0Ñ2Ô2ˆØ#Ô4×8Ò8¸Ñ@Ô@ÐØ#ð	+Ý" 6Ñ*Ô*Ð*Ø'Ð'¨Ñ8Ô8ˆà×,Ò,¨XÀÐ,ÑWÔWÐWrYcó—|jj5|j |¦«}|r|cddd¦«S|d}|d}|d}| ||||¬¦«}||j|<ddd¦«n#1swxYwY|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@rrr)rcÚlockrKrv)rfr‚rRÚpoolr?r@rrs       rWr€z$PoolManager.connection_from_pool_keys÷€ðŒZŒ_ð	(ð	(ð”:—>’> (Ñ+Ô+ˆDØð
Øð	(ð	(ð	(ð	(ñ	(ô	(ð	(ð	(ð% XÔ.ˆFØ" 6Ô*ˆDØ" 6Ô*ˆDØ—>’> &¨$°Ào>ÑVÔVˆDØ#'ˆDŒJxÑ ð	(ð	(ð	(ñ	(ô	(ð	(ð	(ð	(ð	(ð	(ð	(øøøð	(ð	(ð	(ð	(ðˆsA?¸;A?Á?BÂBcóp—t|¦«}| |j|j|j|¬¦«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.
        )rrr?r|)rr}r@rrr?)rfÚurlr|Úus    rWÚconnection_from_urlzPoolManager.connection_from_urls;€õ
c‰NŒNˆØ×(Ò(Ø
ŒF˜œ¨¬¸kð)ñ
ô
ð	
rYcó¨—|j ¦«}|r6| ¦«D]!\}}|€	||=Œ#t$rYŒwxYw|||<Œ"|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.
        )rbrGrJÚKeyError)rfÚoverrideÚbase_pool_kwargsrTÚvalues     rWrzzPoolManager._merge_pool_kwargs/s‰€ð Ô2×7Ò7Ñ9Ô9ÐØð	2Ø&ŸnšnÑ.Ô.ð
2ð
2‘
Uؐ=ðØ,¨SÐ1Ð1øÝ#ðððØ˜ðøøøð-2Ð$ SÑ)Ð)ØÐs¸<¼
A	ÁA	cóV—|j€dSt|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?)rfÚ
parsed_urls  rWÚ!_proxy_requires_url_absolute_formz-PoolManager._proxy_requires_url_absolute_formCs7€ðŒ:ÐØ5å2ØŒJ˜Ô)¨:Ô+<ñ
ô
ð
ð	
rYcóš—|j|dkrdS|jjdkrdStjr|jjst
d¦«‚dSdS)z
        Validates that were not attempting to do TLS in TLS connections on
        Python2 or with unsupported SSL implementations.
        Nr\zfContacting HTTPS destinations through HTTPS proxies 'via CONNECT tunnels' is not supported in Python 2)rr?rÚPY2r‘r<r
)rfÚ
url_schemes  rWÚ$_validate_proxy_scheme_url_selectionz0PoolManager._validate_proxy_scheme_url_selectionPss€ð
Œ:Р¨wÒ!6Ð!6ØˆFàŒ:Ô Ò'Ð'ØˆFåŒ7ð	˜4Ô,ÔEð	Ý(ðEñôð
ð	ð	ð	ð	rYTcóÖ—t|¦«}| |j¦«| |j|j|j¬¦«}d|d<d|d<d|vr|j ¦«|d<| |¦«r|j	||fi|¤Ž}n|j	||j
fi|¤Ž}|o| ¦«}|s|St||¦«}|j
dkr1d}d|d	<t|d¦« ¦«|d<| d
¦«}	t#|	t$¦«st%j|	|¬¦«}	|	jrx| |¦«sct-t/j|d¦«¦«}
|
D]9}| ¦«|	jvr|d |d¦«Œ:	|	 ||||¬¦«}	n.#t8$r!|	jr| ¦«‚|cYSwxYw|	|d
<||d<t>  d
||¦«| ¦«|j	||fi|¤Ž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.
        )rrr?FÚassert_same_hostÚredirectrAi/ÚGETNÚbodyÚretries)rš)ÚresponseÚ_poolzRedirecting %s -> %s)!rr—r?r}r@rrrArGr“ÚurlopenÚrequest_uriÚget_redirect_locationrÚstatusrÚ_prepare_for_method_changerKÚ
isinstancerÚfrom_intÚremove_headers_on_redirectÚis_same_hostrMrÚiterkeysrHrOÚ	incrementrÚraise_on_redirectÚ
drain_connÚlogÚinfo)rfÚmethodr‡ršrurˆÚconnržÚredirect_locationrrAÚheaders            rWr zPoolManager.urlopenas½€õ
c‰NŒNˆØ×1Ò1°!´(Ñ;Ô;Ð;à×(Ò(¨¬°a´fÀQÄXÐ(ÑNÔNˆà!&ˆÐÑØˆˆ:‰à˜BÐÐØ œL×-Ò-Ñ/Ô/ˆBˆy‰Mà×1Ò1°!Ñ4Ô4ð	AØ#t”| F¨CÐ6Ð6°2Ð6Ð6ˆHˆHà#t”| F¨A¬MÐ@Ð@¸RÐ@Ð@ˆHà$ÐI¨×)GÒ)GÑ)IÔ)IÐØ ð	؈Oõ$ CÐ):Ñ;Ô;ÐàŒ?˜cÒ!Ð!àˆFàˆBˆv‰JÝ*¨2¨i¬=Ñ9Ô9×TÒTÑVÔVˆBˆy‰Mà—&’&˜Ñ#Ô#ˆÝ˜'¥5Ñ)Ô)ð	AÝ”n W°xÐ@Ñ@Ô@ˆGð
Ô-ð	4°d×6GÒ6GØñ7
ô7
ð	4õ3œ<¨¨9¬
Ñ6Ô6Ñ7Ô7ˆGØ!ð
4ð
4Ø—<’<‘>”> WÔ%GÐGÐGؐy”M×%Ò% f¨dÑ3Ô3Ð3øð	Ø×'Ò'¨°¸hÈdÐ'ÑSÔSˆGˆGøÝð	ð	ð	ØÔ(ð
Ø×#Ò#Ñ%Ô%Ð%ØØˆOˆOˆOð		øøøð ˆˆ9‰
Ø!ˆˆ:‰åŠÐ'¨Ð.?Ñ@Ô@Ð@à×ÒÑÔÐØˆtŒ|˜FÐ$5Ð<Ð<¸Ð<Ð<Ð<sÇG4Ç4(HÈH)r^Nr`©Nr[N©T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rr‘rarjrprvrlr}r{r€r‰rzr“r—r rFrYrWrrŒs€€€€€ððð6
€EØ€Lð8ð8ð8ð8ððððððð
7ð7ð7ð7ð6ððð=ð=ð=ð=ð.
Xð
Xð
Xððððð0
ð
ð
ð
ð  ð ð ð(
ð
ð
ðððð"D=ðD=ðD=ðD=ðD=ðD=rYrcóN‡—eZdZdZ					dˆfd„	Zdˆfd„	Zd
d„Zdˆfd
„	ZˆxZS)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

    r^NFcóþ•—t|t¦«rd|j|j|jfz}t|¦«}|jdvrt
|j¦«‚|js0tj|jd¦«}	| 	|	¬¦«}||_
|pi|_||_t||¦«|_|j
|d<|j|d<|j|d<tt |¦«j||fi|¤ŽdS)Nz
%s://%s:%irZry)rrÚ_proxyrBÚ
_proxy_config)r¥rr?r@rrrrr	rKÚ_replacerÚ
proxy_headersÚproxy_ssl_contextr=r‘Úsuperrra)rfÚ	proxy_urlrgrAr¾r¿r<rbrrrÚ	__class__s          €rWrazProxyManager.__init__Ðsø€õiÕ!3Ñ4Ô4ð	Ø$ØÔ ؔؔð(ñˆIõ
˜)Ñ$Ô$ˆàŒ<Ð0Ð0Ð0Ý$ U¤\Ñ2Ô2Ð2àŒzð	.Ý!Ô% e¤l°BÑ7Ô7ˆDØ—N’N¨NÑ-Ô-ˆEàˆŒ
Ø*Ð0¨bˆÔØ!2ˆÔÝ'Ð(9Ð;SÑTÔTˆÔà'+¤zИ8Ñ$Ø/3Ô/AÐÐ+Ñ,Ø.2Ô.?И?Ñ+à*l˜DÑ!Ô!Ô*¨9°gÐTÐTÐASÐTÐTÐTÐTÐTrYr[cóü•—|dkr,tt|¦« ||||¬¦«Stt|¦« |jj|jj|jj|¬¦«S)Nr\)r|)rÀrr}rr@rrr?)rfr@rrr?r|rÂs     €rWr}z!ProxyManager.connection_from_hostõs~ø€ØWÒÐݝ tÑ,Ô,×AÒAؐd˜F°ðBñôð
õ•\ 4Ñ(Ô(×=Ò=ØŒJŒO˜TœZœ_¨d¬jÔ.?È[ð>ñ
ô
ð	
rYcór—ddi}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.
        ÚAcceptz*/*ÚHost)rÚnetlocÚupdate)rfr‡rAÚheaders_rÇs     rWÚ_set_proxy_headerszProxyManager._set_proxy_headersÿsM€ð
˜eÐ$ˆå˜3‘”Ô&ˆØð	&Ø%ˆHVÑàð	%ØOŠO˜GÑ$Ô$Ð$؈rYTcó•—t|¦«}t|j|j|j¦«s4| d|j¦«}| ||¦«|d<tt|¦«j
||fd|i|¤ŽS)z@Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.rArš)rrrr‘r?rKrArÊrÀrr )rfr¯r‡ršrurˆrArÂs       €rWr zProxyManager.urlopens‡ø€åc‰NŒNˆÝ.¨t¬z¸4Ô;LÈaÌhÑWÔWð	Bð—f’f˜Y¨¬Ñ5Ô5ˆGØ ×3Ò3°C¸ÑAÔAˆBˆy‰Mà0u•\ 4Ñ(Ô(Ô0°¸ÐVÐVÀxÐVÐSUÐVÐVÐVrY)r^NNNFr³r`r´)	rµr¶r·r¸rar}rÊr Ú
__classcell__)rÂs@rWrr¨sºø€€€€€ð%ð%ðTØØØØ!&ð#Uð#Uð#Uð#Uð#Uð#UðJ
ð
ð
ð
ð
ð
ð
ð
ð
ð
ð
Wð
Wð
Wð
Wð
Wð
Wð
Wð
Wð
Wð
WrYrcó—tdd|i|¤ŽS)NrÁrF)r)r‡rus  rWrrs€ÝÐ,Ð, #Ð,¨Ð,Ð,Ð,rY)/Ú
__future__rÚcollectionsÚ	functoolsÚloggingÚ_collectionsrrÚconnectionpoolrrr	Ú
exceptionsr
rrr
rÚpackagesrÚpackages.six.moves.urllib.parserÚrequestrÚ
util.proxyrÚ
util.retryrÚutil.urlrÚ__all__Ú	getLoggerrµr­rsÚ_key_fieldsÚ
namedtupler;Ú_proxy_config_fieldsr=rXÚpartialrerdrrrrFrYrWú<module>rás]ðØ&Ð&Ð&Ð&Ð&Ð&àÐÐÐØÐÐÐØ€€€à?Ð?Ð?Ð?Ð?Ð?Ð?Ð?ØSÐSÐSÐSÐSÐSÐSÐSÐSÐSðððððððððððððððÐÐÐÐÐØ4Ð4Ð4Ð4Ð4Ð4Ø#Ð#Ð#Ð#Ð#Ð#Ø7Ð7Ð7Ð7Ð7Ð7ØÐÐÐÐÐØÐÐÐÐÐà
;Ð
;Ð
;€ð€gÔ˜Ñ!Ô!€ð
€ð€ð>!ˆ+Ô
  ¨KÑ
8Ô
8€àBÐØ$ˆkÔ$ ]Ð4HÑIÔI€ð. ð. ð. ðl
ˆIÔÐ5°wÑ?Ô?Ø
ˆYÔ
Ð6¸Ñ
@Ô
@ððÐð
#5Ð?RÐSÐSÐðY=ðY=ðY=ðY=ðY=.ñY=ôY=ðY=ðxpWðpWðpWðpWðpW;ñpWôpWðpWðf-ð-ð-ð-ð-rY