Viewing File: /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/client.cpython-38.pyc

U

'7`@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlZddlmZm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(dd	l)m*Z*dd
l+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>ddl?m@Z@mAZAmBZBmCZCmDZDddlEmFZFdd
lGmHZHmIZImJZJmKZKddlLmMZMddlNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWddl'mXZXmYZYmZZZm[Z[ddl\m]Z]m^Z^m_Z_m`Z`ddlambZbddlcmdZdmeZeddlfmgZgmhZhmiZimjZjdZkzddllmmZmWnenk
rFeoZmYnXejpddddGdddZqeqddZredZsGdddZtGd d!d!ee
e
esfeesZuGd"d#d#eueAZvGd$d%d%eueFZwGd&d'd'Zxdddddddd(ddd)ddddeVde'jydddd*ezejeeezezfe
e
eeieeezeeQe{e|eezee{e{ee{e{eejeeQeeqeofeeheYeeHee|eej}exd+d,d-Z~dS).zHTTP Client for asyncio.N)SimpleNamespace
TracebackType)Any	AwaitableCallable	Coroutine	FrozenSet	GeneratorGenericIterableListMappingOptionalSetTupleTypeTypeVarUnion)CIMultiDict	MultiDictMultiDictProxyistr)URL)hdrshttppayload)AbstractCookieJar)ClientConnectionErrorClientConnectorCertificateErrorClientConnectorErrorClientConnectorSSLErrorClientErrorClientHttpProxyError
ClientOSErrorClientPayloadErrorClientProxyConnectionErrorClientResponseErrorClientSSLErrorContentTypeError
InvalidURLServerConnectionErrorServerDisconnectedErrorServerFingerprintMismatchServerTimeoutErrorTooManyRedirectsWSServerHandshakeError)
ClientRequestClientResponseFingerprintRequestInfo_merge_ssl_params)ClientWebSocketResponse)
BaseConnectorNamedPipeConnectorTCPConnector
UnixConnector)	CookieJar)	DEBUGPY_36	BasicAuthCeilTimeout
TimeoutHandleget_running_loopproxies_from_envsentinelstrip_auth_from_url)WS_KEYHttpVersionWebSocketReaderWebSocketWriter)WSHandshakeError	WSMessage
ws_ext_genws_ext_parse)FlowControlDataQueue)TraceTraceConfig)JSONEncoderLooseCookiesLooseHeadersStrOrURL)rrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r7r9r:r8r6
ClientSession
ClientTimeoutrequest)
SSLContextT)Zauto_attribsfrozenslotsc@sNeZdZUdZeeed<dZeeed<dZeeed<dZ	eeed<dS)rUNtotalconnect	sock_readsock_connect)
__name__
__module____qualname__rZrfloat__annotations__r[r\r]rcrcA/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/client.pyrUs
rUi,rZ_RetTypecseZdZdZedddddddd	d
ddd
dddddddddgZdZddddddeje	e
eej
dddededdddddeeeejeeeeeeeeeeee	ee
eeeeeeeeeefeeeee feeeee!e"e#ddddZ$edddd d!Z%e&r*ee'dd"fd#d$Z(e)fe'dd%d&d'Z*ee+e'd(d)d*d+Z,ddddddddd,dddddddedddddddd-ee+ee-eefe'e'eeeeeeeeeee#eeeeeeeeee+eeee efeeee.ee/eee/ee0feeee1ee#e
d.d/d0Z2e3j4d1d2ddddddddddddddd3d4d5e+eeeeeeeeeeeeeeeeee+eeee/ede0feeee.ee/eee#e#d6d7d8d9Z5e3j4d1d2ddddddddddddddd3d4d5e+eeeeeeeeeeeeeeeeee+eeee/ede0feeee.ee/eee#e#ed7d:d;Z6eed<d=d>d?Z7dd@e+ee'd(dAdBdCZ8dd@e+ee'd(dAdDdEZ9dd@e+ee'd(dAdFdGZ:ddHe+e'e'd(dIdJdKZ;ddHe+e'e'd(dIdLdMZ<ddHe+e'e'd(dIdNdOZ=e+e'd(dPdQdRZ>ddSdTdUZ?e@edSdVdWZAe@eedSdXdYZBe@edSdZd[ZCe@eDe#e#fdSd\d]ZEe@edSd^d_ZFeFjGedd`dad_ZFe@ejdSdbdcZHe@eee fdSdddeZIe@d<dSdfdgZJe@eKeLdSdhdiZMe@eedSdjdkZNe@edSdldmZOe@edSdndoZPe@eeeQe
geRdffdSdpdqZSe@edSdrdsZTe@edSdtduZUe@e!e"dSdvdwZVddSdxdyZWddSdzd{ZXeeeYeeYeeZdd|d}d~Z[ddSddZ\eeeYeeYeeZdd|ddZ]Z^S)rTz/First-class interface for making HTTP requests._source_traceback
_connectorrequote_redirect_url_loop_cookie_jar_connector_owner
_default_auth_version_json_serialize_requote_redirect_url_timeout_raise_for_status_auto_decompress
_trust_env_default_headers_skip_auto_headers_request_class_response_class_ws_response_class_trace_configs
_read_bufsizeNTF)	connectorloopcookiesheadersskip_auto_headersauthjson_serialize
request_classresponse_classws_response_classversion
cookie_jarconnector_ownerraise_for_statusread_timeoutconn_timeouttimeoutauto_decompress	trust_envri
trace_configsread_bufsize)r}r~rrrrrrrrrrrrrrrrrrirrreturncCs|dkr|dk	r|j}t|}|dkr0t|d}|j|k	rBtd||_|rbttd|_	|dkrtt
|d}||_|dk	r|j|||_
|
|_||_||_||_|tkrt|_|tk	rtjdtddtj|j|d|_|dk	r>tj|j|d|_tjd	tddn*||_|tk	r,td
|dk	r>td||_||_||_||_||_|rlt |}nt }||_!|dk	rt"dd
|D|_#nt"|_#||_$|	|_%|
|_&|pg|_'|j'D]}|(qdS)Nr~z0Session and connector has to use same event looprz8read_timeout is deprecated, use timeout argument instead
stacklevelre)r[z8conn_timeout is deprecated, use timeout argument insteadzGread_timeout and timeout parameters conflict, please setup timeout.readzJconn_timeout and timeout parameters conflict, please setup timeout.connectcSsg|]}t|qSrc)r).0ircrcrd
<listcomp>%sz*ClientSession.__init__.<locals>.<listcomp>))rjrAr9RuntimeErrorZ	get_debug	traceback
extract_stacksys	_getframergr;rkupdate_cookiesrhrlrmrnrorCDEFAULT_TIMEOUTrqwarningswarnDeprecationWarningattrZevolve
ValueErrorrrrsrtrpr{rru	frozensetrvrwrxryrzZfreeze)selfr}r~rrrrrrrrrrrrrrrrrrirrreal_headerstrace_configrcrcrd__init__s









zClientSession.__init__)clsrcCstjd|jtdddS)Nz6Inheritance class {} from ClientSession is discouragedrr)rrformatr^r)rrcrcrd__init_subclass__1szClientSession.__init_subclass__)namevalrcs2||jkr tjd|tddt||dS)Nz8Setting custom ClientSession.{} attribute is discouragedrr)ATTRSrrrrsuper__setattr__)rrr	__class__rcrdr;s
zClientSession.__setattr__)	_warningsrcCs\|jsXtrd|i}ni}|jd|tf||dd}|jdk	rL|j|d<|j|dS)NsourcezUnclosed client session zUnclosed client session)Zclient_sessionmessageZsource_traceback)closedr=rResourceWarningrgrjZcall_exception_handler)rrkwargscontextrcrcrd__del__Es



zClientSession.__del___RequestContextManager)methodurlrrcKst|j||f|S)zPerform HTTP request.)r_request)rrrrrcrcrdrVSszClientSession.request
)paramsdatajsonrrrrallow_redirects
max_redirectscompresschunked	expect100rread_until_eofproxy
proxy_authr
verify_sslfingerprintssl_contextssl
proxy_headerstrace_request_ctxr)r
str_or_urlrrrrrrrrrrrrrrrrrrrrrrrrrc4s6jrtdt||||}|dk	r6|dk	r6tdn|dk	rNtj|jd}t|
tsl|
dk	rlt	
dtd}g}j}
|}
|}zt|}Wn,tk
r}zt||W5d}~XYnXtj} |dk	r|D]}!| t|!q|dk	r8zt|}Wn.tk
r6}zt||W5d}~XYnX|tkrJj}"nt|tsbt|d}"n|}"tj|"j}#|#}$|dkrj}fddjD}%|%D]}&|&|||IdHq|#}'z|'xt|\}}(|	r|(rtd	|	dkr|(}	|	dkrj }	|dk	r<|	dk	r<t!j"|kr<td
j#$|})|dk	r|t%}*|*&||*$|}+|+r||)'|+|dk	rt|}n<j(rt)*D](\},}-|,|j+kr|-j,}|-j-}q̐qj.||||| ||)|	|||
|jj/|||'|||%d}.zHt0|"j1jd.j2dk	s(t3j2j1|.|%|"d
IdH}/W5QRXWn6t4j5k
r}0zt6d7||0W5d}0~0XYnX|/j8dk	st3|/j9dk	st3|/j9j:|'|;dk|j<|"j=|dzpzJ|.>|/IdH}1z|1|/IdHWn t?k
r|1@YnXWn t?k
r4|/@YnXWnFtAk
rPYn0tBk
r~}0ztC|0jD|0W5d}0~0XYnXj#&|1jE|1jF|1jGdkrH|
rH|%D]}&|&H||||1IdHq|d7}|I|1|r||kr|1@tJ|djKtL||1jGdkr|1jMt!jNks8|1jGdkr\|1jMt!jOkr\t!jP}d}|Qt!jRr\|St!jR|1jTQt!jUpx|1jTQt!jV}2|2dkrqHn|1Wzt|2jXd}3Wn.tk
r}zt|2|W5d}~XYnX|3j+},|,dkr|1@tdn|,s|Y|3}3|Z|3Zkr,d}	|St!j"d|3}d}|1Wq֐qHqW5QRX|dkrbj[}|rp|1\|$dk	r|1j]dk	r|1j]^|$j_n|$_tL||1_`|%D]}&|&a||||1IdHq|1WSt?k
r0}zB|#@|$r|$_d}$|%D]}&|&b||||IdHqW5d}~XYnXdS)NzSession is closedz9data and json parameters can not be used at the same time)dumpszChunk size is deprecated #1615rrecs g|]}t||jdqS))r)rNZtrace_config_ctx)rrrrrcrdrs
z*ClientSession._request.<locals>.<listcomp>z<Cannot combine AUTH argument with credentials encoded in URLzTCannot combine AUTHORIZATION header with AUTH argument or credentials encoded in URL)rrrrrrrrrrr~rrrtimersessionrrtracesr)rrzConnection timeout to host {}ZHEAD)rZskip_payloadrrrr)-./i3i4rr)rr)Zencoded)rZhttpsz"Can redirect only to http or https)crrr5rrZJsonPayloadro
isinstanceboolrrrrn_prepare_headersrr*setrvaddrrCrqrUr@rjrZstartr{rzZsend_request_startrrDrmrZ
AUTHORIZATIONrkZfilter_cookiesr;rloadrtrBitemsschemerrrwrxr?r[rhAssertionErrorasyncioTimeoutErrorr.r	transportprotocolZset_response_paramsupperrsr\send
BaseExceptioncloser"OSErrorr$argsrrstatusZsend_request_redirectappendr/request_infotupler	METH_HEAD	METH_POSTMETH_GETgetZCONTENT_LENGTHpoprZLOCATIONZURIreleaserpjoinoriginrrr
connectionZadd_callbackZcancelZ_historyZsend_request_endZsend_request_exception)4rrrrrrrrrrrrrrrrrrrrrrrrrrrZ	redirectshistoryrreZskip_headersrZreal_timeoutZtmZhandlerZtracerZ
auth_from_urlZall_cookiesZtmp_cookie_jarZreq_cookiesrZ
proxy_infoZreqconnexcrespZr_urlZ
parsed_urlrcrrdrYs#





	









	









zClientSession._requestrcg$@ri@r	protocolsrreceive_timeout	autocloseautoping	heartbeatrrrrrrrrrrrmax_msg_size_WSRequestContextManager)rrrrrrrrrrrrrrrrrrrr	rcCs6t|j|||||||||	|
|||
|||||||dS)zInitiate websocket connection.r)r
_ws_connect)rrrrrrrrrrrrrrrrrrrrr	rcrcrd
ws_connects0zClientSession.ws_connectc)sJ|dkrt}nt|}tjdtjdtjdi}|D]\}}|||q6tt	
d}||tj<|r~d
||tj<|
dk	r|
|tj<|rt|d}||tj<t||||}|j|||d|	||
||d	IdH}z&|jd	krt|j|jd
|j|jd|jtjddkr6t|j|jd
|j|jd|jtjddkrjt|j|jd|j|jd|jtjd}tt|t}||krt|j|jd|j|jdd}|rtj|jkrdd|jtj dD}|D]} | |kr| }qqd}!|r|jtj}"|"rzt!|"\}}!WnFt"k
r}#z&t|j|j|#j#d|j|jd|#W5d}#~#XYnXnd}d}!|j$}$|$dk	st%|$j&}%|%dk	st%|$j'}&|&dk	st%t(|%d|j)d}'|%*t+|'||'t,|%|&d||!d}(Wn t-k
r |.Yn&X|j/|'|(||||||j)||||!dSdS)NZ	websocketZupgradeZ13,)rF)rrrrrrrezInvalid response status)rrrrzInvalid upgrade headerzInvalid connection headerzInvalid challenge responsecSsg|]}|qSrc)strip)rprotorcrcrdr*sz-ClientSession._ws_connect.<locals>.<listcomp>rr|rT)Zuse_maskr
notakeover)rrrZclient_notakeover)0rrZUPGRADEZ
CONNECTIONZSEC_WEBSOCKET_VERSIONr
setdefaultbase64Z	b64encodeosurandomdecodeZSEC_WEBSOCKET_KEYrZSEC_WEBSOCKET_PROTOCOLZORIGINrKZSEC_WEBSOCKET_EXTENSIONSr5rVrr0rrrrlowerZSEC_WEBSOCKET_ACCEPThashlibZsha1rEZdigestsplitrLrIrrrrrrMrjZ
set_parserrGrHrrry))rrrrrrrrrrrrrrrrrrrrr	rZdefault_headerskeyvalueZsec_keyZextstrrZr_keymatchrZresp_protocolsrrZ
compress_hdrsrrZ
conn_protorreaderwriterrcrcrdrs


	
	


zClientSession._ws_connectzCIMultiDict[str])rrcCsht|j}|rdt|ttfs$t|}t}|D]0\}}||krP|||q2|||<||q2|S)z3Add default headers and transform it to CIMultiDict)rrurrrrrr)rrresultZadded_namesrrrcrcrdrks
zClientSession._prepare_headers)r)rrrrcKst|jtj|fd|i|S)zPerform HTTP GET request.r)rrrrrrrrrcrcrdr{szClientSession.getcKst|jtj|fd|i|S)zPerform HTTP OPTIONS request.r)rrrZMETH_OPTIONSr!rcrcrdoptionsszClientSession.optionscKst|jtj|fd|i|S)zPerform HTTP HEAD request.r)rrrrr!rcrcrdheadszClientSession.head)r)rrrrcKst|jtj|fd|i|S)zPerform HTTP POST request.r)rrrrrrrrrcrcrdpostszClientSession.postcKst|jtj|fd|i|S)zPerform HTTP PUT request.r)rrrZMETH_PUTr$rcrcrdputszClientSession.putcKst|jtj|fd|i|S)zPerform HTTP PATCH request.r)rrrZ
METH_PATCHr$rcrcrdpatchszClientSession.patch)rrrcKst|jtj|f|S)zPerform HTTP DELETE request.)rrrZMETH_DELETE)rrrrcrcrddeleteszClientSession.deletercs0|js,|jdk	r&|jr&|jIdHd|_dS)zMClose underlying connector.

        Release all acquired resources.
        N)rrhrlrrrcrcrdrszClientSession.closecCs|jdkp|jjS)z@Is client session closed.

        A readonly property.
        N)rhrr*rcrcrdrszClientSession.closedcCs|jS)z(Connector instance used for the session.rhr*rcrcrdr}szClientSession.connectorcCs|jS)zThe session cookies.)rkr*rcrcrdrszClientSession.cookie_jarcCs|jS)z"The session HTTP protocol version.)rnr*rcrcrdrszClientSession.versioncCs|jS))Do URL requoting on redirection handling.)rpr*rcrcrdrisz"ClientSession.requote_redirect_url)rrcCstjdtdd||_dS)r,z=session.requote_redirect_url modification is deprecated #2778rrN)rrrrp)rrrcrcrdriscCstjdtdd|jS)zSession's loop.z"client.loop property is deprecatedrr)rrrrjr*rcrcrdr~szClientSession.loopcCs|jS)zTimeout for the session.)rqr*rcrcrdrszClientSession.timeoutcCs|jS)z*The default headers of the client session.)rur*rcrcrdrszClientSession.headerscCs|jS)z2Headers for which autogeneration should be skipped)rvr*rcrcrdrszClientSession.skip_auto_headerscCs|jS)z2An object that represents HTTP Basic Authorization)rmr*rcrcrdrszClientSession.authcCs|jS)zJson serializer callable)ror*rcrcrdrszClientSession.json_serializecCs|jS)z-Should connector be closed on session closing)rlr*rcrcrdrszClientSession.connector_ownercCs|jS)z`
        Should `ClientResponse.raise_for_status()`
        be called for each response
        )rrr*rcrcrdr	szClientSession.raise_for_statuscCs|jS)z6Should the body response be automatically decompressed)rsr*rcrcrdrszClientSession.auto_decompresscCs|jS)z
        Should get proxies information
        from HTTP_PROXY / HTTPS_PROXY environment variables
        or ~/.netrc file if present
        )rtr*rcrcrdrszClientSession.trust_envcCs|jS)z7A list of TraceConfig instances used for client tracing)rzr*rcrcrdr!szClientSession.trace_configscCs
d|_dS)zwDetach connector from session without closing the former.

        Session is switched to closed state anyway.
        Nr+r*rcrcrddetach&szClientSession.detachcCstddS)NzUse async with instead)	TypeErrorr*rcrcrd	__enter__-szClientSession.__enter__)exc_typeexc_valexc_tbrcCsdSNrcrr0r1r2rcrcrd__exit__0szClientSession.__exit__cs|Sr3rcr*rcrcrd
__aenter__9szClientSession.__aenter__cs|IdHdSr3)rr4rcrcrd	__aexit__<szClientSession.__aexit__)_r^r_r`__doc__rrrgrrr1r2r6r
HttpVersion11rCrr7rAbstractEventLooprQrRrstrr>rPrrFrrrraobjectrUrrOintrrr<rrrrrSrVr
bytesrWr3rrrrrrrrr"r#r%r&r'r(rpropertyrr}rrrrisetterr~rrrrrrrrrrrrrrr-r/rrr5r6r7
__classcell__rcrcrrdrTsv



o


86/			
		
	
rTc@seZdZdZeddefddddZddddd	Zeddd
dZ	ddd
dZ
eedefdddZ
eedefdddZedddZdS)_BaseRequestContextManager_coro_respasyncio.Future[Any]N)cororcCs
||_dSr3)rD)rrGrcrcrdrIsz#_BaseRequestContextManager.__init__)argrcCs|j|Sr3)rDrrrHrcrcrdrLsz_BaseRequestContextManager.sendcCs|j|dSr3)rDthrowrIrcrcrdrJOsz _BaseRequestContextManager.throwr)cCs
|jSr3)rDrr*rcrcrdrRsz _BaseRequestContextManager.closecCs|j}|Sr3)rD	__await__)rZretrcrcrdrKUs
z$_BaseRequestContextManager.__await__cCs|Sr3)rKr*rcrcrd__iter__Ysz#_BaseRequestContextManager.__iter__cs|jIdH|_|jSr3rCr*rcrcrdr6\sz%_BaseRequestContextManager.__aenter__)r^r_r`	__slots__rrfrrrrJrr	rrKrLr6rcrcrcrdrBEsrBc@s0eZdZeeeeeeeddddZdS)rNr0rtbrcs|jdSr3)rErrr0rrOrcrcrdr7bsz _RequestContextManager.__aexit__r^r_r`rrrrr7rcrcrcrdras

rc@s0eZdZeeeeeeeddddZdS)r
NrNcs|jIdHdSr3)rErrPrcrcrdr7qsz"_WSRequestContextManager.__aexit__rQrcrcrcrdr
ps

r
c@s^eZdZdZeddefeddddZeddd	Ze	e
ee	ee	edd
ddZ
dS)
_SessionRequestContextManagerrDrE_sessionrFN)rGrrcCs||_d|_||_dSr3rS)rrGrrcrcrdr~sz&_SessionRequestContextManager.__init__r)csDz|jIdH|_Wn&tk
r8|jIdHYnX|jSdSr3)rDrErrTrr*rcrcrdr6sz(_SessionRequestContextManager.__aenter__rNcs,|jdk	st|j|jIdHdSr3)rErrrTrPrcrcrdr7s
z'_SessionRequestContextManager.__aexit__)r^r_r`rMrr2rTrr6rrrrr7rcrcrcrdrRzs	
rRrF)rrrrrrrrrrrrrrrrrrr}rr~)rrrrrrrrrrrrrrrrrrrrr}rr~rcCsdd}|dkrd}t|dd}t||||||d}t|j||||||||||	|
|||
||||d|S)aConstructs and sends a request. Returns response object.
    method - HTTP method
    url - request url
    params - (optional) Dictionary or bytes to be sent in the query
      string of the new request
    data - (optional) Dictionary, bytes, or file-like object to
      send in the body of the request
    json - (optional) Any json compatible python object
    headers - (optional) Dictionary of HTTP Headers to send with
      the request
    cookies - (optional) Dict object to send with the request
    auth - (optional) BasicAuth named tuple represent HTTP Basic Auth
    auth - aiohttp.helpers.BasicAuth
    allow_redirects - (optional) If set to False, do not follow
      redirects
    version - Request HTTP version.
    compress - Set to True if request has to be compressed
       with deflate encoding.
    chunked - Set to chunk size for chunked transfer encoding.
    expect100 - Expect 100-continue response from server.
    connector - BaseConnector sub-class instance to support
       connection pooling.
    read_until_eof - Read response until eof if response
       does not have Content-Length header.
    loop - Optional event loop.
    timeout - Optional ClientTimeout settings structure, 5min
       total timeout by default.
    Usage::
      >>> import aiohttp
      >>> resp = await aiohttp.request('GET', 'http://python.org/')
      >>> resp
      <ClientResponse(python.org/) [200]>
      >>> data = await resp.read()
    FNT)r~Zforce_close)r~rrrr}r)rrrrrrrrrrrrrrrr)r9rTrRr)rrrrrrrrrrrrrrrrrrrrr}rr~rrrcrcrdrVsF<	rV)r8rrrrrrrrtypesrrtypingrrrrrr	r
rrr
rrrrrrrZ	multidictrrrrZyarlrrrrrabcrZclient_exceptionsrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0Z
client_reqrepr1r2r3r4r5Z	client_wsr6r}r7r8r9r:Z	cookiejarr;Zhelpersr<r=r>r?r@rArBrCrDrErFrGrHZhttp_websocketrIrJrKrLZstreamsrMtracingrNrOZtypedefsrPrQrRrS__all__rrWImportErrorr<srUrrfrTrBrr
rRr9r;rr=r:rVrcrcrcrd<module>sHT,(

) 
%


Back to Directory File Manager