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

250 lines
19 KiB
Plaintext
Raw Normal View History

2022-11-30 15:58:16 +07:00
o
<00>Ԅc<D484>u<00>@sjdZddlZddlZddlZddlmZddlmZddlm Z ddl
m Z ddl m Z dd lmZmZmZmZdd
lmZmZmZmZdd lmZmZmZmZdd lmZmZdd l m!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3ej4dkr<>ej5Z6nejZ6efdd<13>Z7efdd<15>Z8Gdd<17>d<17>Z9Gdd<19>de9<65>Z:dd<1B>Z;dS)z<>
requests.sessions
~~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
<EFBFBD>N)<01> OrderedDict)<01> timedelta<74>)<01>to_native_string)<01> HTTPAdapter)<01>_basic_auth_str)<04>Mapping<6E> cookielib<69>urljoin<69>urlparse)<04>RequestsCookieJar<61>cookiejar_from_dict<63>extract_cookies_to_jar<61> merge_cookies)<04>ChunkedEncodingError<6F>ContentDecodingError<6F> InvalidSchema<6D>TooManyRedirects)<02> default_hooks<6B> dispatch_hook)<04>DEFAULT_REDIRECT_LIMIT<49>REDIRECT_STATI<54>PreparedRequest<73>Request)<01>codes)<01>CaseInsensitiveDict)
<EFBFBD> DEFAULT_PORTS<54>default_headers<72>get_auth_from_url<72>get_environ_proxies<65>get_netrc_auth<74> requote_uri<72>resolve_proxies<65> rewind_body<64>should_bypass_proxies<65>to_key_val_list<73>win32cCsp|dur|S|dur |St|t<01>rt|t<01>s|S|t|<01><01>}|<03>t|<00><01>dd<03>|<03><04>D<00>}|D]}||=q0|S)z<>Determines appropriate setting for a given request, taking into account
the explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
NcSsg|]
\}}|dur|<01>qS<00>N<>)<03>.0<EFBFBD>k<>vr(r(<00>d/home/infidel/Sync/Project/ocp-wg-backend/acer-env/lib/python3.10/site-packages/requests/sessions.py<70>
<listcomp>Tsz!merge_setting.<locals>.<listcomp>)<05>
isinstancerr%<00>update<74>items)<06>request_setting<6E>session_setting<6E>
dict_class<EFBFBD>merged_setting<6E> none_keys<79>keyr(r(r,<00> merge_setting=s<02><02> r7cCs@|dus |<01>d<02>gkr |S|dus|<00>d<02>gkr|St|||<02>S)z<>Properly merges both requests and session hooks.
This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.
N<>response)<02>getr7)<03> request_hooks<6B> session_hooksr3r(r(r,<00> merge_hooks[s
 r<c@sJeZdZdd<02>Zdd<04>Z      ddd <09>Zd
d <0B>Zd d <0A>Zdd<0F>ZdS)<11>SessionRedirectMixincCs(|jr|jd}|<02>d<02>}t|d<03>SdS)z7Receives a Response. Returns a redirect URI or ``None``<60>location<6F>latin1<6E>utf8N)<04> is_redirect<63>headers<72>encoder)<03>self<6C>respr>r(r(r,<00>get_redirect_targetks



z(SessionRedirectMixin.get_redirect_targetcCs<>t|<01>}t|<02>}|j|jkrdS|jdkr&|jdvr&|jdkr&|jdvr&dS|j|jk}|j|jk}t<04>|jd<07>df}|sI|j|vrI|j|vrIdS|pL|S)zFDecide whether Authorization header should be removed when redirectingT<67>http)<02>PN<>https)i<>NFN)r <00>hostname<6D>scheme<6D>portrr9)rD<00>old_url<72>new_url<72>
old_parsed<EFBFBD>
new_parsed<EFBFBD> changed_port<72>changed_scheme<6D> default_portr(r(r,<00>should_strip_auths0 <02><02><02><02>  <02><02><02>z&SessionRedirectMixin.should_strip_authFNTc 
ksB<00>g}
|<00>|<01>} t|j<02>j} | <0B>r|<02><04>} |
<EFBFBD>|<01>|
dd<02>|_z|jWntt t
fy9|j j dd<04>Ynwt |j<06>|jkrMtd|j<0E>d<06>|d<07><02>|<01><10>| <0B>d<08>ret|j<02>}d <09>t|j<14>| g<02>} t| <0B>}|jd
krw| rw|j| d <0B>}n|jr}|j} |<0F><16>} |js<>t|jt| <0B><01>} nt| <0B>} t| <0B>| _|<00>| |<01>|jtjtjfvr<>d }|D] }| j<1F> |d<02>q<>d| _!| j}|<12> d d<02>t"| j#||j <0B>t$| j#|j%<25>| <0A>&| j#<23>|<00>'| |<07>}|<00>(| |<01>| j)duo<>d|vp<>d|v}|r<>t*| <0A>| }|r<>|Vn |j+|f|||||dd<10>| <09><01>}t"|j%| |j <0B>|<00>|<01>} |V| sdSdS)zBReceives a Response. Returns a generator of Responses or Requests.rNF)<01>decode_contentz Exceeded z redirects.)r8z//<2F>:<3A>)<01>fragment)<03>Content-Lengthz Content-Type<70>Transfer-Encoding<6E>CookierYrZ)<06>stream<61>timeout<75>verify<66>cert<72>proxies<65>allow_redirects),rFr <00>urlrX<00>copy<70>append<6E>history<72>contentrr<00> RuntimeError<6F>raw<61>read<61>len<65> max_redirectsr<00>close<73>
startswith<EFBFBD>joinrrK<00>_replace<63>geturl<72>netlocr
r!<00>rebuild_method<6F> status_coder<00>temporary_redirect<63>permanent_redirectrB<00>pop<6F>bodyr<00>_cookiesr<00>cookies<65>prepare_cookies<65>rebuild_proxies<65> rebuild_auth<74>_body_positionr#<00>send)rDrE<00>reqr\r]r^r_r`<00>yield_requests<74>adapter_kwargs<67>histrb<00>previous_fragment<6E>prepared_request<73> parsed_rurl<72>parsed<65>purged_headers<72>headerrB<00>
rewindabler(r(r,<00>resolve_redirects<74>s<><02>
 

<02><06>


 <06>    
<02><02><04><06>
 <0C>z&SessionRedirectMixin.resolve_redirectscCsV|j}|j}d|vr|<00>|jj|<04>r|d=|jrt|<04>nd}|dur)|<01>|<05>dSdS)z<>When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
<20> AuthorizationN)rBrbrT<00>request<73> trust_envr <00> prepare_auth)rDr<>r8rBrb<00>new_authr(r(r,r|s <04><04>z!SessionRedirectMixin.rebuild_authcCsx|j}t|j<02>j}t|||j<05>}d|vr|d=z
t||<00>\}}Wn ty.d\}}Ynw|r:|r:t||<07>|d<|S)a<>This method re-evaluates the proxy configuration by considering the
environment variables. If we are redirected to a URL covered by
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
proxy keys for this URL (in case they were stripped by a previous
redirect).
This method also replaces the Proxy-Authorization header where
necessary.
:rtype: dict
zProxy-Authorization<6F>NN) rBr rbrKr"r<>r<00>KeyErrorr)rDr<>r`rBrK<00> new_proxies<65>username<6D>passwordr(r(r,r{/s   <02>z$SessionRedirectMixin.rebuild_proxiescCsX|j}|jtjkr|dkrd}|jtjkr|dkrd}|jtjkr'|dkr'd}||_dS)z<>When being redirected we may want to change the method of the request
based on certain specs or browser behavior.
<20>HEAD<41>GET<45>POSTN)<06>methodrsr<00> see_other<65>found<6E>moved)rDr<>r8r<>r(r(r,rrLs
z#SessionRedirectMixin.rebuild_method)FNTNNF) <09>__name__<5F>
__module__<EFBFBD> __qualname__rFrTr<>r|r{rrr(r(r(r,r=js$
<EFBFBD>| r=c@s<>eZdZdZgd<02>Zdd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Z d+d d<0E>Z dd<10>Z
dd<12>Z dd<14>Z d,dd<16>Z d-dd<18>Zd-dd<1A>Zdd<1C>Zdd<1E>Zdd <20>Zd!d"<22>Zd#d$<24>Zd%d&<26>Zd'd(<28>Zd)d*<2A>Zd S).<2E>Sessiona<6E>A Requests session.
Provides cookie persistence, connection-pooling, and configuration.
Basic Usage::
>>> import requests
>>> s = requests.Session()
>>> s.get('https://httpbin.org/get')
<Response [200]>
Or as a context manager::
>>> with requests.Session() as s:
... s.get('https://httpbin.org/get')
<Response [200]>
) rBry<00>authr`<00>hooks<6B>paramsr^r_<00>adaptersr\r<>rkcCsrt<00>|_d|_i|_t<04>|_i|_d|_d|_d|_ t
|_ d|_ t i<00>|_t<0F>|_|<00>dt<12><00>|<00>dt<12><00>dS)NFTzhttps://zhttp://)rrBr<>r`rr<>r<>r\r^r_rrkr<>r ryrr<><00>mountr<00>rDr(r(r,<00>__init__<5F>s

zSession.__init__cCs|Sr'r(r<>r(r(r,<00> __enter__<5F>szSession.__enter__cGs |<00><00>dSr')rl)rD<00>argsr(r(r,<00>__exit__<5F>s zSession.__exit__c Cs<>|jpi}t|tj<03>st|<02>}ttt<06>|j<00>|<02>}|j}|jr)|s)|js)t |j
<EFBFBD>}t <0B>}|j |j <0A><0E>|j
|j|j|jt|j|jtd<01>t|j|j<15>t||j<07>|t|j|j<17>d<02>
|S)a<>Constructs a :class:`PreparedRequest <PreparedRequest>` for
transmission and returns it. The :class:`PreparedRequest` has settings
merged from the :class:`Request <Request>` instance and those of the
:class:`Session`.
:param request: :class:`Request` instance to prepare with this
session's settings.
:rtype: requests.PreparedRequest
)r3)
r<EFBFBD>rb<00>files<65>data<74>jsonrBr<>r<>ryr<>)ryr.r <00> CookieJarr rr r<>r<>r rbr<00>preparer<65><00>upperr<72>r<>r<>r7rBrr<>r<r<>)rDr<>ry<00>merged_cookiesr<73><00>pr(r(r,<00>prepare_request<73>s2
<04>

<04> 
 <06>zSession.prepare_requestNTc Csxt|<01><01>||||p
i||pi||| d<01>
}|<00>|<11>}| pi} |<00>|j| | ||<0F>}| |
d<02>}|<14>|<13>|j|fi|<14><01>}|S)aw Constructs a :class:`Request <Request>`, prepares it and sends it.
Returns :class:`Response <Response>` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param params: (optional) Dictionary or bytes to be sent in the query
string for the :class:`Request`.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the
:class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the
:class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the
:class:`Request`.
:param files: (optional) Dictionary of ``'filename': file-like-objects``
for multipart encoding upload.
:param auth: (optional) Auth tuple or callable to enable
Basic/Digest/Custom HTTP Auth.
: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) <timeouts>` tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Set to True by default.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol or protocol and
hostname to the URL of the proxy.
:param stream: (optional) whether to immediately download the response
content. Defaults to ``False``.
: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. Defaults to ``True``. When set to
``False``, requests will accept any TLS certificate presented by
the server, and will ignore hostname mismatches and/or expired
certificates, which will make your application vulnerable to
man-in-the-middle (MitM) attacks. Setting verify to ``False``
may be useful during local development or testing.
:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
:rtype: requests.Response
)
r<EFBFBD>rbrBr<>r<>r<>r<>r<>ryr<>)r]ra)rr<>r<><00>merge_environment_settingsrbr/r~)rDr<>rbr<>r<>rBryr<>r<>r]rar`r<>r\r^r_r<>r<00>prep<65>settings<67> send_kwargsrEr(r(r,r<><00>s.=<06>
 <04><06>
zSession.requestcK<00> |<02>dd<02>|jd|fi|<02><01>S)z<>Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
raTr<54><00><02>
setdefaultr<EFBFBD><00>rDrb<00>kwargsr(r(r,r9O<00> z Session.getcKr<>)z<>Sends a OPTIONS request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
raT<>OPTIONSr<53>r<>r(r(r,<00>optionsZr<>zSession.optionscKr<>)z<>Sends a HEAD request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
raFr<46>r<>r<>r(r(r,<00>header<>z Session.headcKs|jd|f||d<02>|<04><01>S)a<>Sends a POST request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param json: (optional) json to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
r<>)r<>r<><00>r<>)rDrbr<>r<>r<>r(r(r,<00>postps z Session.postcK<00>|jd|fd|i|<03><01>S)auSends a PUT request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
<20>PUTr<54>r<><00>rDrbr<>r<>r(r(r,<00>put}<00>
z Session.putcKr<>)awSends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, list of tuples, bytes, or file-like
object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
<20>PATCHr<48>r<>r<>r(r(r,<00>patch<63>r<>z Session.patchcKs|jd|fi|<02><01>S)z<>Sends a DELETE request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
<20>DELETEr<45>r<>r(r(r,<00>delete<74>szSession.deletec Ks<>|<02>d|j<01>|<02>d|j<02>|<02>d|j<03>d|vr#t||j|j<06>|d<t|t<08>r,t d<05><01>|<02>
dd<07>}|<02> d<01>}|j }|j |jd<08>}t<0F>}|j|fi|<02><01>}t<0F>|} t| d <09>|_td
||fi|<02><01>}|jrt|jD] }
t|j|
j|
j<18>qht|j||j<18>|r<>|j||fi|<02><01>} d d <0C>| D<00>} ng} | r<>| <0C>d |<08>| <0C>
<EFBFBD>}| |_|s<>zt|j||fddi|<02><01><01>|_Wn ty<>Ynw|s<>|j|S)zISend a given PreparedRequest.
:rtype: requests.Response
r\r^r_r`z#You can only send PreparedRequests.raT)rb)<01>secondsr8cSsg|]}|<01>qSr(r()r)rEr(r(r,r-<00>sz Session.send.<locals>.<listcomp>rr<>)r<>r\r^r_r"r`r<>r.r<00>
ValueErrorrvr9r<><00> get_adapterrb<00>preferred_clockr~r<00>elapsedrrerryr<>rhr<><00>insert<72>next<78>_next<78> StopIterationrf) rDr<>r<>rar\r<><00>adapter<65>start<72>rr<72>rE<00>genrer(r(r,r~<00>sN
 

 
 
<EFBFBD> <02>z Session.sendc
Cs<>|jr9|dur |<02>d<02>nd}t||d<03>}|<07><03>D]
\}} |<02>|| <09>q|dus+|dur9tj<06>d<05>p8tj<06>d<06>p8|}t||j<08>}t||j <09>}t||j
<EFBFBD>}t||j <0B>}||||d<07>S)z^
Check the environment and merge it with some settings.
:rtype: dict
N<>no_proxy)r<>T<>REQUESTS_CA_BUNDLE<4C>CURL_CA_BUNDLE)r`r\r^r_) r<>r9rr0r<><00>os<6F>environr7r`r\r^r_)
rDrbr`r\r^r_r<><00> env_proxiesr*r+r(r(r,r<><00>s   
<02><02>    z"Session.merge_environment_settingscCs<|j<00><01>D]\}}|<01><02><00>|<02><02><00>r|Sqtd|<01><02><02><01>)z~
Returns the appropriate connection adapter for the given URL.
:rtype: requests.adapters.BaseAdapter
z&No connection adapters were found for )r<>r0<00>lowerrmr)rDrb<00>prefixr<78>r(r(r,r<> s
<02>zSession.get_adaptercCs|j<00><01>D]}|<01><02>qdS)z+Closes all adapters and as such the sessionN)r<><00>valuesrl)rDr+r(r(r,rls
<04>z Session.closecs>||j<00><<00>fdd<02>|jD<00>}|D] }|j<00>|<04>|j|<qdS)zwRegisters a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
cs g|] }t|<01>t<00><00>kr|<01>qSr()rj)r)r*<00>r<>r(r,r-%s z!Session.mount.<locals>.<listcomp>N)r<>rv)rDr<>r<><00> keys_to_mover6r(r<>r,r<>s
<04>z Session.mountcs<00>fdd<02><08>jD<00>}|S)Ncsi|] }|t<00>|d<00><03>qSr')<01>getattr)r)<00>attrr<72>r(r,<00>
<dictcomp>+sz(Session.__getstate__.<locals>.<dictcomp>)<01> __attrs__)rD<00>stater(r<>r,<00> __getstate__*szSession.__getstate__cCs"|<01><00>D]
\}}t|||<03>qdSr')r0<00>setattr)rDr<>r<><00>valuer(r(r,<00> __setstate__.s<04>zSession.__setstate__)NNNNNNNTNNNNNNr<4E>r')r<>r<>r<><00>__doc__r<5F>r<>r<>r<>r<>r<>r9r<>r<>r<>r<>r<>r<>r~r<>r<>rlr<>r<>r<>r(r(r(r,r<>csH>/
<EFBFBD>[ 
 
N r<>cCst<00>S)aZ
Returns a :class:`Session` for context-management.
.. deprecated:: 1.0.0
This method has been deprecated since version 1.0.0 and is only kept for
backwards compatibility. New code should use :class:`~requests.sessions.Session`
to create a session. This may be removed at a future date.
:rtype: Session
)r<>r(r(r(r,<00>session3s r<>)<r<>r<><00>sys<79>time<6D> collectionsr<00>datetimer<00>_internal_utilsrr<>rr<>r<00>compatrr r
r ryr r rr<00>
exceptionsrrrrr<>rr<00>modelsrrrr<00> status_codesr<00>
structuresr<00>utilsrrrrr r!r"r#r$r%<00>platform<72> perf_counterr<72>r7r<r=r<>r<>r(r(r(r,<00><module>s:       0
  z S