/usr/lib/python3.9/site-packages/requests/__pycache__
NameSizeModeActions
adapters.cpython-39.opt-1.pyc225890644editdlrm
adapters.cpython-39.pyc225890644editdlrm
api.cpython-39.opt-1.pyc67110644editdlrm
api.cpython-39.pyc67110644editdlrm
auth.cpython-39.opt-1.pyc82830644editdlrm
auth.cpython-39.pyc82830644editdlrm
certs.cpython-39.opt-1.pyc8320644editdlrm
certs.cpython-39.pyc8320644editdlrm
compat.cpython-39.opt-1.pyc16050644editdlrm
compat.cpython-39.pyc16050644editdlrm
cookies.cpython-39.opt-1.pyc187740644editdlrm
cookies.cpython-39.pyc187740644editdlrm
exceptions.cpython-39.opt-1.pyc51850644editdlrm
exceptions.cpython-39.pyc51850644editdlrm
help.cpython-39.opt-1.pyc26100644editdlrm
help.cpython-39.pyc26100644editdlrm
hooks.cpython-39.opt-1.pyc9420644editdlrm
hooks.cpython-39.pyc9420644editdlrm
models.cpython-39.opt-1.pyc238190644editdlrm
models.cpython-39.pyc238190644editdlrm
packages.cpython-39.opt-1.pyc3610644editdlrm
packages.cpython-39.pyc3610644editdlrm
sessions.cpython-39.opt-1.pyc198160644editdlrm
sessions.cpython-39.pyc198160644editdlrm
status_codes.cpython-39.opt-1.pyc41910644editdlrm
status_codes.cpython-39.pyc41910644editdlrm
structures.cpython-39.opt-1.pyc44120644editdlrm
structures.cpython-39.pyc44120644editdlrm
utils.cpython-39.opt-1.pyc237500644editdlrm
utils.cpython-39.pyc237500644editdlrm
_internal_utils.cpython-39.opt-1.pyc12280644editdlrm
_internal_utils.cpython-39.pyc12540644editdlrm
__init__.cpython-39.opt-1.pyc32890644editdlrm
__init__.cpython-39.pyc34330644editdlrm
__version__.cpython-39.opt-1.pyc5070644editdlrm
__version__.cpython-39.pyc5070644editdlrm
Edit: /usr/lib/python3.9/site-packages/requests/__pycache__/adapters.cpython-39.pyc (22589B)
a ¥/�h7qã@sNdZddlZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5mZmZm6Z6m7Z7m8Z8m9Z9ddl:m;Z;zddl�y¨dd„Z=Yn0dZ?d Z@dZAdZBz ddlCZCeƒZDeD Ee(e'ƒ¡Wne>�yòdZDYn0d!d"ejFeGejHfeId#œd$d%„ZJd&d!d"d'd(d)œd*d+„ZKGd,d-„d-eLƒZMGd.d/„d/eMƒZNdS)0z‰ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. éN)Ú PoolManagerÚproxy_from_url)Ú HTTPResponse)Ú parse_url)ÚTimeout)ÚRetry)Úcreate_urllib3_context)ÚClosedPoolError)ÚConnectTimeoutError)Ú HTTPError)Ú MaxRetryError)ÚNewConnectionError)Ú ProxyError)Ú ProtocolError)ÚReadTimeoutError)ÚSSLError)Ú ResponseError)ÚLocationValueErroré)ÚResponse)ÚurlparseÚ basestring)ÚDEFAULT_CA_BUNDLE_PATHÚextract_zipped_pathsÚget_encoding_from_headersÚprepend_scheme_if_neededÚget_auth_from_urlÚ urldefragauthÚ select_proxy)ÚCaseInsensitiveDict)Úextract_cookies_to_jar) ÚConnectionErrorÚConnectTimeoutÚ ReadTimeoutrrÚ RetryErrorÚ InvalidSchemaÚInvalidProxyURLÚ InvalidURL)Ú_basic_auth_str)ÚSOCKSProxyManagercOs tdƒ‚dS)Nz'Missing dependencies for SOCKS support.)r%)ÚargsÚkwargs©r,ú5/usr/lib/python3.9/site-packages/requests/adapters.pyr)0sr)Fé zbool | str | Nonez#typing.Tuple[str, str] | str | None)ÚverifyÚ client_certÚpoolmanager_kwargsÚreturncCs,| d¡}|duo&tduo&| o&|du}|S)NÚ ssl_contextT)ÚgetÚ_preloaded_ssl_context)r/r0r1Zhas_poolmanager_ssl_contextZshould_use_default_ssl_contextr,r,r-Ú_should_use_default_contextEs ÿþür6ZPreparedRequestrz<(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]))Úrequestr/r0Ú poolmanagerr2c Csþi}i}t|jƒ}|j ¡}|j}t|diƒ} d} d} |durDd} n6t||| ƒrZt|d<n |durltt ƒ} nt |t ƒrz|} | dur t j  | ¡s˜| |d<n| |d<| |d <|durèt |tƒràt|ƒd krà|d |d <|d |d<n||d <||j|dœ}||fS)NZconnection_pool_kwÚ CERT_REQUIREDFÚ CERT_NONEr3TÚca_certsÚ ca_cert_dirÚ cert_reqsérÚ cert_filerÚkey_file)ÚschemeÚhostÚport)rÚurlrAÚlowerrCÚgetattrr6r5rrÚ isinstanceÚstrÚosÚpathÚisdirÚtupleÚlenÚhostname) r7r/r0r8Ú host_paramsÚ pool_kwargsZparsed_request_urlrArCr1r=Úcert_locr,r,r-Ú_urllib3_request_contextVs>          ýrRcs2eZdZdZ‡fdd„Zd dd„Zd d „Z‡ZS) Ú BaseAdapterzThe Base Transport Adaptercstt|ƒ ¡dS©N)ÚsuperrSÚ__init__©Úself©Ú __class__r,r-rVˆszBaseAdapter.__init__FNTcCst‚dS)aCSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. N©ÚNotImplementedError)rXr7ÚstreamÚtimeoutr/ÚcertÚproxiesr,r,r-Úsend‹szBaseAdapter.sendcCst‚dS)z!Cleans up adapter specific items.Nr[rWr,r,r-Úclose�szBaseAdapter.close)FNTNN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rVrarbÚ __classcell__r,r,rYr-rS…s  ÿ rScs®eZdZdZgd¢Zeeeef‡fdd„ Zdd„Z dd„Z efd d „Z d d „Z d d„Z dd„Zd$dd„Zd%dd„Zd&dd„Zdd„Zdd„Zdd„Zdd„Zd'd"d#„Z‡ZS)(Ú HTTPAdaptera�The built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) )Ú max_retriesÚconfigÚ_pool_connectionsÚ _pool_maxsizeÚ _pool_blockcsd|tkrtddd�|_n t |¡|_i|_i|_tt|ƒ ¡||_ ||_ ||_ |j |||d�dS)NrF)Úread©Úblock) ÚDEFAULT_RETRIESrriZfrom_intrjÚ proxy_managerrUrhrVrkrlrmÚinit_poolmanager)rXZpool_connectionsZ pool_maxsizeriZ pool_blockrYr,r-rV¿s zHTTPAdapter.__init__cs‡fdd„ˆjDƒS)Ncsi|]}|tˆ|dƒ“qSrT)rF)Ú.0ÚattrrWr,r-Ú Òóz,HTTPAdapter.__getstate__..)Ú __attrs__rWr,rWr-Ú __getstate__ÑszHTTPAdapter.__getstate__cCsDi|_i|_| ¡D]\}}t|||ƒq|j|j|j|jd�dS)Nro)rrrjÚitemsÚsetattrrsrkrlrm)rXÚstateruÚvaluer,r,r-Ú __setstate__Ôs ÿzHTTPAdapter.__setstate__cKs0||_||_||_tf|||ddœ|¤Ž|_dS)aInitializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. T)Ú num_poolsÚmaxsizerpÚstrictN)rkrlrmrr8)rXZ connectionsr€rprPr,r,r-rsàs ÿÿzHTTPAdapter.init_poolmanagercKs–||jvr|j|}n|| ¡ d¡r^t|ƒ\}}t|f|||j|j|jdœ|¤Ž}|j|<n4| |¡}t |f||j|j|jdœ|¤Ž}|j|<|S)aÏReturn urllib3 ProxyManager for the given proxy. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager :rtype: urllib3.ProxyManager Úsocks)ÚusernameÚpasswordrr€rp)Ú proxy_headersrr€rp) rrrEÚ startswithrr)rkrlrmr…r)rXÚproxyZ proxy_kwargsZmanagerrƒr„r…r,r,r-Úproxy_manager_forôs6   ÿúù ÿûúzHTTPAdapter.proxy_manager_forcCsè| ¡ d¡rZ|rZd|_|durl|}tj |¡s>td|›�ƒ‚tj |¡sR||_ql||_ nd|_d|_d|_ |rät |t ƒs�|d|_ |d|_ n ||_ d|_ |j rÀtj |j ¡sÀtd  |j ¡ƒ‚|j rätj |j ¡sätd  |j ¡ƒ‚dS) aAVerify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: The SSL certificate to verify. Úhttpsr9TzCCould not find a suitable TLS CA certificate bundle, invalid path: r:Nrrz9Could not find the TLS certificate file, invalid path: {}z1Could not find the TLS key file, invalid path: {})rEr†r=rIrJÚexistsÚOSErrorrKr;r<rGrr?r@ÚIOErrorÚformat)rXÚconnrDr/r_rQr,r,r-Ú cert_verifys<  ÿÿ    ÿÿzHTTPAdapter.cert_verifycCs„tƒ}t|ddƒ|_tt|diƒƒ|_t|jƒ|_||_|jj|_t |j t ƒr^|j   d¡|_ n|j |_ t |j||ƒ||_||_|S)a¶Builds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. :rtype: requests.Response ÚstatusNÚheadersúutf-8)rrFZ status_coderr‘rÚencodingÚrawÚreasonrGrDÚbytesÚdecoder Úcookiesr7Ú connection)rXZreqÚrespZresponser,r,r-Úbuild_responseLs    zHTTPAdapter.build_responseNcCst||||jƒS)a¢ Build the PoolKey attributes used by urllib3 to return a connection. This looks at the PreparedRequest, the user-specified verify value, and the value of the cert parameter to determine what PoolKey values to use to select a connection from a given urllib3 Connection Pool. The SSL related pool key arguments are not consistently set. As of this writing, use the following to determine what keys may be in that dictionary: * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the default Requests SSL Context * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but ``"cert_reqs"`` will be set * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) ``"ca_certs"`` will be set if the string is not a directory recognized by :py:func:`os.path.isdir`, otherwise ``"ca_certs_dir"`` will be set. * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If ``"cert"`` is a tuple with a second item, ``"key_file"`` will also be present To override these settings, one may subclass this class, call this method and use the above logic to change parameters as desired. For example, if one wishes to use a custom :py:class:`ssl.SSLContext` one must both set ``"ssl_context"`` and based on what else they require, alter the other keys to ensure the desired behaviour. :param request: The PreparedReqest being sent over the connection. :type request: :class:`~requests.models.PreparedRequest` :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param cert: (optional) Any user-provided SSL certificate for client authentication (a.k.a., mTLS). This may be a string (i.e., just the path to a file which holds both certificate and key) or a tuple of length 2 with the certificate file path and key file path. :returns: A tuple of two dictionaries. The first is the "host parameters" portion of the Pool Key including scheme, hostname, and port. The second is a dictionary of SSLContext related parameters. )rRr8)rXr7r/r_r,r,r-Ú$build_connection_pool_key_attributesqs+z0HTTPAdapter.build_connection_pool_key_attributesc Csºt|j|ƒ}z| |||¡\}}Wn0tyR}zt||d�‚WYd}~n d}~00|rœt|dƒ}t|ƒ} | jsxtdƒ‚|  |¡} | j fi|¤d|i¤Ž} n|j j fi|¤d|i¤Ž} | S)apReturns a urllib3 connection for the given request and TLS settings. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` object to be sent over the connection. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param proxies: (optional) The proxies dictionary to apply to the request. :param cert: (optional) Any user-provided SSL certificate to be used for client authentication (a.k.a., mTLS). :rtype: urllib3.ConnectionPool ©r7NÚhttpúFPlease check proxy URL. It is malformed and could be missing the host.rP) rrDrœÚ ValueErrorr'rrrBr&rˆZconnection_from_hostr8) rXr7r/r`r_r‡rOrPÚeÚ proxy_urlrrrŽr,r,r-Úget_connection_with_tls_contextžs8 ý " ÿ ÿÿ  ÿÿz+HTTPAdapter.get_connection_with_tls_contextcCsdt||ƒ}|rDt|dƒ}t|ƒ}|js.tdƒ‚| |¡}| |¡}nt|ƒ}| ¡}|j  |¡}|S)aDEPRECATED: Users should move to `get_connection_with_tls_context` for all subclasses of HTTPAdapter using Requests>=2.32.2. Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. :rtype: urllib3.ConnectionPool ržrŸ) rrrrBr&rˆZconnection_from_urlrÚgeturlr8)rXrDr`r‡r¢rrrŽÚparsedr,r,r-Úget_connectionÍs     zHTTPAdapter.get_connectioncCs&|j ¡|j ¡D] }| ¡qdS)z¢Disposes of any internal state. Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections. N)r8ÚclearrrÚvalues)rXr‡r,r,r-rbês zHTTPAdapter.closec Cs`t|j|ƒ}t|jƒj}|o"|dk}d}|rDt|ƒj ¡}| d¡}|j}|r\|s\t|jƒ}|S)a?Obtain the url to use when making the final request. If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. :rtype: str r‰Fr‚)rrDrrArEr†Zpath_urlr) rXr7r`r‡rAZis_proxied_http_requestZusing_socks_proxyZ proxy_schemerDr,r,r-Ú request_urlôs     zHTTPAdapter.request_urlcKsdS)a"Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). Nr,)rXr7r+r,r,r-Ú add_headerss zHTTPAdapter.add_headerscCs&i}t|ƒ\}}|r"t||ƒ|d<|S)aReturns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The url of the proxy being used for this request. :rtype: dict zProxy-Authorization)rr()rXr‡r‘rƒr„r,r,r-r…s  ÿzHTTPAdapter.proxy_headersFTc Csôz|j||||d�}Wn0tyF}zt||d�‚WYd}~n d}~00| ||j||¡| ||¡} |j||||||d�|jdupŽd|jv } t |t ƒrîz|\} } t | | d�}Wn6t yê}zd  |¡} t | ƒ‚WYd}~n d}~00nt |t ƒrún t ||d�}�zD| �s:|j|j| |j|jdddd|j|d � }�nt|d ƒ�rL|j}|jtd �}zØ|j|j| d d �|j ¡D]\}}| ||¡�qv| ¡|jD]D}| tt|ƒƒdd… d¡¡| d¡| |¡| d¡�qœ| d¡z|jd d�}Wnt�y| ¡}Yn0tj |||ddd�}Wn| !¡‚Yn0W�nšt"t#j$f�y†} zt%| |d�‚WYd} ~ �njd} ~ 0t&�y,}zŽt |j't(ƒ�r¾t |j't)ƒ�s¾t*||d�‚t |j't+ƒ�rØt,||d�‚t |j't-ƒ�ròt.||d�‚t |j't/ƒ�r t0||d�‚t%||d�‚WYd}~nÄd}~0t1�y\}zt%||d�‚WYd}~n”d}~0t-�yˆ}zt.|ƒ‚WYd}~nhd}~0t/t2f�yæ}zBt |t/ƒ�r¶t0||d�‚nt |t3ƒ�rÐt4||d�‚n‚WYd}~n d}~00| 5||¡S)aSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response )r`r_r�N)r]r^r/r_r`zContent-Length)ÚconnectrnzrInvalid timeout {}. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same valueF) ÚmethodrDÚbodyr‘ZredirectZassert_same_hostÚpreload_contentÚdecode_contentZretriesr^Ú proxy_pool)r^T)Zskip_accept_encodingr>r’s s0 )Ú buffering)Zpoolr™r®r¯)6r£rr'r�rDr©rªr­r‘rGrLÚ TimeoutSaucer r�Zurlopenr¬riÚhasattrr°Z _get_connÚDEFAULT_POOL_TIMEOUTZ putrequestrzZ putheaderZ endheadersraÚhexrMÚencodeZ getresponseÚ TypeErrorrZ from_httplibrbrÚsocketÚerrorr!r r•r r r"rr$Ú _ProxyErrorrÚ _SSLErrorrr Ú _HTTPErrorrr#r›)rXr7r]r^r/r_r`rŽr¡rDZchunkedr«rnÚerrršZlow_connÚheaderr}ÚiÚrr,r,r-ra5s¶ÿ "  þ   ö   þ     û "        zHTTPAdapter.send)N)NN)N)FNTNN)rcrdrerfrxÚDEFAULT_POOLSIZErqÚDEFAULT_POOLBLOCKrVryr~rsrˆr�r›rœr£r¦rbr©rªr…rargr,r,rYr-rh¢s(þ %3% - /  rh)OrfZos.pathrIr¸ÚtypingZurllib3.poolmanagerrrZurllib3.responserZ urllib3.utilrrr²Zurllib3.util.retryrZurllib3.util.ssl_rZurllib3.exceptionsr r r r¼r r rrºrrrr»rrZmodelsrÚcompatrrZutilsrrrrrrrZ structuresrr˜r Ú exceptionsr!r"r#r$r%r&r'Zauthr(Zurllib3.contrib.socksr)Ú ImportErrorrÂrÁrqr´Zsslr5Zload_verify_locationsÚDictrHÚAnyÚboolr6rRÚobjectrSrhr,r,r,r-Úsp                 $  , ÿ ü û /