Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/requests/__pycache__/sessions.cpython-37.pyc

259 lines
19 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
#U<>]<5D>r<00>@s<>dZddlZddlZddlZddlmZddlmZddlm Z m
Z
m Z m Z m Z mZddlmZmZmZmZddlmZmZmZdd lmZmZdd
lmZdd lmZmZm Z dd l!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'ddl(m)Z)ddlm*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ddlm2Z2ej3dk<02>rNy
ej4Z5Wne6k
<EFBFBD>rJej7Z5YnXnejZ5e fdd<14>Z8e fdd<16>Z9Gdd<18>de:<3A>Z;Gdd<1A>de;<3B>Z<dd<1C>Z=dS)z<>
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
<EFBFBD>N)<01> timedelta<74>)<01>_basic_auth_str)<06> cookielib<69>is_py3<79> OrderedDict<63>urljoin<69>urlparse<73>Mapping)<04>cookiejar_from_dict<63>extract_cookies_to_jar<61>RequestsCookieJar<61> merge_cookies)<03>Request<73>PreparedRequest<73>DEFAULT_REDIRECT_LIMIT)<02> default_hooks<6B> dispatch_hook)<01>to_native_string)<03>to_key_val_list<73>default_headers<72> DEFAULT_PORTS)<04>TooManyRedirects<74> InvalidSchema<6D>ChunkedEncodingError<6F>ContentDecodingError)<01>CaseInsensitiveDict)<01> HTTPAdapter)<06> requote_uri<72>get_environ_proxies<65>get_netrc_auth<74>should_bypass_proxies<65>get_auth_from_url<72> rewind_body)<01>codes)<01>REDIRECT_STATI<54>win32cCst|dkr |S|dkr|St|t<01>r,t|t<01>s0|S|t|<01><01>}|<03>t|<00><01>dd<03>|<03><04>D<00>}x|D]
}||=qbW|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|]\}}|dkr|<01>qS)N<>)<03>.0<EFBFBD>k<>vr'r'<00>7/tmp/pip-install-zuyyrlx8/requests/requests/sessions.py<70>
<listcomp>Isz!merge_setting.<locals>.<listcomp>)<05>
isinstancer
r<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_setting1s

 

r6cCs@|dks|<01>d<02>gkr|S|dks0|<00>d<02>gkr4|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>getr6)<03> request_hooks<6B> session_hooksr2r'r'r+<00> merge_hooksPs
r;c@s>eZdZdd<02>Zdd<04>Zddd <09>Zd
d <0B>Zd d <0A>Zdd<0F>ZdS)<11>SessionRedirectMixincCs,|jr(|jd}tr|<02>d<02>}t|d<03>SdS)z7Receives a Response. Returns a redirect URI or ``None``<60>location<6F>latin1<6E>utf8N)<05> is_redirect<63>headersr<00>encoder)<03>self<6C>respr=r'r'r+<00>get_redirect_targetas 


z(SessionRedirectMixin.get_redirect_targetcCs<>t|<01>}t|<02>}|j|jkr dS|jdkrL|jdkrL|jdkrL|jdkrLdS|j|jk}|j|jk}t<04>|jd<07>df}|s<>|j|kr<>|j|kr<>dS|p<>|S)zFDecide whether Authorization header should be removed when redirectingT<67>http)<02>PN<>https)i<>NFN)r <00>hostname<6D>scheme<6D>portrr8)rC<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_authvs   
z&SessionRedirectMixin.should_strip_authFNTc 
ksdg}
|<00>|<01>} t|j<02>j} <0C>xB| <0B>r^|<02><04>} |
<EFBFBD>|<01>|
dd<02>|_y
|jWn(tt t
fk
rv|j j dd<04>YnXt |j<06>|jkr<>td|j|d<06><02>|<01><10>| <0B>d<07>r<>t|j<02>}dt|j<13>| f} t| <0B>}|jd kr<>| r<>|j| d
<EFBFBD>}n |jr<>|j} |<0F><15>} |j<16>st|jt| <0B><01>} nt| <0B>} t| <0B>| _|<00>| |<01>|jtjtjfk<07>rtd }x|D]}| j<1E>|d<02><00>qVWd| _ | j}y
|d =Wnt!k
<EFBFBD>r<>YnXt"| j#||j <0B>t$| j#|j%<25>| <0A>&| j#<23>|<00>'| |<07>}|<00>(| |<01>| j)dk <09>o<>d |k<06>p<>d|k}|<13>r
t*| <0A>| }|<08>r|Vq|j+|f|||||dd<0F>| <09><02>}t"|j%| |j <0B>|<00>|<01>} |VqWdS)zBReceives a Response. Returns a generator of Responses or Requests.rNF)<01>decode_contentzExceeded %s redirects.)r7z//z%s:%s<>)<01>fragment)zContent-Lengthz Content-TypezTransfer-Encoding<6E>CookiezContent-LengthzTransfer-Encoding)<06>stream<61>timeout<75>verify<66>cert<72>proxies<65>allow_redirects),rEr <00>urlrV<00>copy<70>append<6E>history<72>contentrr<00> RuntimeError<6F>raw<61>read<61>len<65> max_redirectsr<00>close<73>
startswithrrJ<00>_replace<63>geturl<72>netlocrr<00>rebuild_method<6F> status_coder$<00>temporary_redirect<63>permanent_redirectrA<00>pop<6F>body<64>KeyErrorr <00>_cookiesr<00>cookies<65>prepare_cookies<65>rebuild_proxies<65> rebuild_auth<74>_body_positionr#<00>send)rCrD<00>reqrXrYrZr[r\<00>yield_requests<74>adapter_kwargs<67>histr^<00>previous_fragment<6E>prepared_request<73> parsed_rurl<72>parsed<65>purged_headers<72>headerrA<00>
rewindabler'r'r+<00>resolve_redirects<74>s|
 





 

    
z&SessionRedirectMixin.resolve_redirectscCsR|j}|j}d|kr*|<00>|jj|<04>r*|d=|jr8t|<04>nd}|dk rN|<01>|<05>dS)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)rAr^rS<00>request<73> trust_envr <00> prepare_auth)rCr<>r7rAr^<00>new_authr'r'r+rxs
z!SessionRedirectMixin.rebuild_authc Cs<>|dk r |ni}|j}|j}t|<04>j}|<02><04>}|<02>d<02>}t||d<03>}|jr||s|t||d<03>} | <09>|| <09>d<04><01>}
|
r||<06> ||
<EFBFBD>d|kr<>|d=yt
||<00>\} } Wnt k
r<EFBFBD>d\} } YnX| r<>| r<>t | | <0C>|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
N<>no_proxy)r<><00>allzProxy-Authorization)NN) rAr^r rJr_r8r!r<>r<00>
setdefaultr"rsr) rCr<>r\rAr^rJ<00> new_proxiesr<73><00> bypass_proxy<78>environ_proxies<65>proxy<78>username<6D>passwordr'r'r+rws* 

 
  z$SessionRedirectMixin.rebuild_proxiescCsX|j}|jtjkr|dkrd}|jtjkr6|dkr6d}|jtjkrN|dkrNd}||_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>methodrnr$<00> see_other<65>found<6E>moved)rCr<>r7r<>r'r'r+rm=sz#SessionRedirectMixin.rebuild_method)FNTNNF) <09>__name__<5F>
__module__<EFBFBD> __qualname__rErSr<>rxrwrmr'r'r'r+r<_s
p)r<c@s<>eZdZdZdddddddd d
d d d dg Zdd<10>Zdd<12>Zdd<14>Zdd<16>Zd7dd<1A>Z dd<1C>Z
dd<1E>Z dd <20>Z d8d!d"<22>Z d9d#d$<24>Zd:d%d&<26>Zd'd(<28>Zd)d*<2A>Zd+d,<2C>Zd-d.<2E>Zd/d0<64>Zd1d2<64>Zd3d4<64>Zd5d6<64>ZdS);<3B>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]>
rAru<00>authr\<00>hooks<6B>paramsrZr[<00>prefetch<63>adaptersrXr<>rgcCsrt<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://)rrAr<>r\rr<>r<>rXrZr[rrgr<>r rurr<><00>mountr)rCr'r'r+<00>__init__ms
zSession.__init__cCs|S)Nr')rCr'r'r+<00> __enter__<5F>szSession.__enter__cGs |<00><00>dS)N)rh)rC<00>argsr'r'r+<00>__exit__<5F>szSession.__exit__c Cs<>|jpi}t|tj<03>st|<02>}ttt<06>|j<00>|<02>}|j}|jrR|sR|jsRt |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
)r2)
r<EFBFBD>r^<00>files<65>data<74>jsonrAr<>r<>rur<>)rur-r<00> CookieJarr rr r<>r<>r r^r<00>preparer<65><00>upperr<72>r<>r<>r6rArr<>r;r<>)rCr<>ru<00>merged_cookiesr<73><00>pr'r'r+<00>prepare_request<73>s*
 
 
zSession.prepare_requestNTc Cstt|<01><01>||||pi||pi||| d<01>
}|<00>|<11>}| p8i} |<00>|j| | ||<0F>}| |
d<02>}|<14>|<13>|j|f|<14>}|S)aConstructs 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``.
:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
:rtype: requests.Response
)
r<EFBFBD>r^rAr<>r<>r<>r<>r<>rur<>)rYr])rr<>r<><00>merge_environment_settingsr^r.rz)rCr<>r^r<>r<>rArur<>r<>rYr]r\r<>rXrZr[r<>r{<00>prep<65>settings<67> send_kwargsrDr'r'r+r<><00>s()

zSession.requestcKs|<02>dd<02>|jd|f|<02>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
r]Tr<54>)r<>r<>)rCr^<00>kwargsr'r'r+r8s z Session.getcKs|<02>dd<02>|jd|f|<02>S)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
r]T<>OPTIONS)r<>r<>)rCr^r<>r'r'r+<00>options$s zSession.optionscKs|<02>dd<02>|jd|f|<02>S)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
r]Fr<46>)r<>r<>)rCr^r<>r'r'r+<00>head/s z Session.headcKs|jd|f||d<02>|<04><02>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<>)r<>)rCr^r<>r<>r<>r'r'r+<00>post:s z Session.postcKs|jd|fd|i|<03><02>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<>)rCr^r<>r<>r'r'r+<00>putGs
z Session.putcKs|jd|fd|i|<03><02>S)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<>)rCr^r<>r<>r'r'r+<00>patchSs
z Session.patchcKs|jd|f|<02>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>DELETE)r<>)rCr^r<>r'r'r+<00>delete_szSession.deletec Ks~|<02>d|j<01>|<02>d|j<02>|<02>d|j<03>|<02>d|j<04>t|t<06>rJtd<05><01>|<02>dd<07>}|<02> d<01>}|j
}|j |j d<08>}t <0A>}|j|f|<02>}t <0A>|} t| d <09>|_td
||f|<02>}|jr<>x |jD]}
t|j|
j|
j<16>q<>Wt|j||j<16>|j||f|<02>} |<03>r
d d <0C>| D<00>ng} | <0C>r.| <0C>d |<08>| <0C><08>}| |_|<03>sny"t|j||fddi|<02><02><01>|_Wntk
<EFBFBD>rlYnX|<04>sz|j|S)zISend a given PreparedRequest.
:rtype: requests.Response
rXrZr[r\z#You can only send PreparedRequests.r]T)r^)<01>secondsr7cSsg|]}|<01>qSr'r')r(rDr'r'r+r,<00>sz Session.send.<locals>.<listcomp>rr|)r<>rXrZr[r\r-r<00>
ValueErrorrqr8r<><00> get_adapterr^<00>preferred_clockrzr<00>elapsedrrar rur<>rdr<><00>insert<72>next<78>_next<78> StopIterationrb) rCr<>r<>r]rXr<><00>adapter<65>start<72>rr<72>rD<00>genrar'r'r+rzisB
 

   "z Session.sendc
Cs<>|jrr|dk r|<02>d<02>nd}t||d<03>}x |<07><03>D]\}} |<02>|| <09>q2W|dksZ|dkrrtj<06>d<05>pptj<06>d<06>}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
Nr<4E>)r<>T<>REQUESTS_CA_BUNDLE<4C>CURL_CA_BUNDLE)rZr\rXr[) r<>r8rr/r<><00>os<6F>environr6r\rXrZr[)
rCr^r\rXrZr[r<><00> env_proxiesr)r*r'r'r+r<><00>s       z"Session.merge_environment_settingscCs>x,|j<00><01>D]\}}|<01><02><00>|<02><02><00>r |Sq Wtd|<00><01>dS)z~
Returns the appropriate connection adapter for the given URL.
:rtype: requests.adapters.BaseAdapter
z*No connection adapters were found for '%s'N)r<>r/<00>lowerrir)rCr^<00>prefixr<78>r'r'r+r<><00>szSession.get_adaptercCs x|j<00><01>D] }|<01><02>q WdS)z+Closes all adapters and as such the sessionN)r<><00>valuesrh)rCr*r'r'r+rh<00>sz Session.closecsB||j<00><<00>fdd<02>|jD<00>}x|D]}|j<00>|<04>|j|<q$WdS)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')rf)r(r))r<>r'r+r,<00>sz!Session.mount.<locals>.<listcomp>N)r<>rq)rCr<>r<><00> keys_to_mover5r')r<>r+r<><00>s

z Session.mountcs<00>fdd<02><08>jD<00>}|S)Ncsi|]}t<00>|d<00>|<01>qS)N)<01>getattr)r(<00>attr)rCr'r+<00>
<dictcomp><3E>sz(Session.__getstate__.<locals>.<dictcomp>)<01> __attrs__)rC<00>stater')rCr+<00> __getstate__<5F>szSession.__getstate__cCs&x |<01><00>D]\}}t|||<03>q
WdS)N)r/<00>setattr)rCr<>r<><00>valuer'r'r+<00> __setstate__<5F>szSession.__setstate__)NNNNNNNTNNNNNN)NN)N)N)r<>r<>r<><00>__doc__r<5F>r<>r<>r<>r<>r<>r8r<>r<>r<>r<>r<>r<>rzr<>r<>rhr<>r<>r<>r'r'r'r+r<>Ts2
7)
D  

I 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>session<6F>s r<>)>r<>r<><00>sys<79>time<6D>datetimerr<>r<00>compatrrrrr r
rur r r r<00>modelsrrrr<>rr<00>_internal_utilsr<00>utilsrrr<00>
exceptionsrrrr<00>
structuresrr<>rrrr r!r"r#<00> status_codesr$r%<00>platform<72> perf_counterr<72><00>AttributeError<6F>clockr6r;<00>objectr<r<>r<>r'r'r'r+<00><module> s@          
  v%