HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/aiohttp/__pycache__/client_reqrep.cpython-310.pyc
o

���g���
@sxddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZddl
mZmZmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZm Z ddl!Z!ddl"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(dd	l)m*Z*m+Z+m,Z,m-Z-m.Z.dd
l/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9dd
l:m;Z;ddl+m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFddl,mGZGmHZHmIZImJZJmKZKddlLmMZMddlNmOZOddlPmQZQmRZRmSZSmTZTmUZUmVZVer�ddlWZWddlWmXZXnzddlWZWddlWmXZXWneY�y
dZWeZZXYnwdZ[e�r%ddl\m]Z]ddl^m_Z_ddl`maZae�bd�Zce�bd�Zddeefdd�Zfe!jgdddd�Gdd �d ��ZhGd!d"�d"e�ZiGd#d$�d$ei�ZjGd%d&�d&�ZkeWdu�rkeWjXelekemd�fZnnelemd�fZnd'e d(elekfd)eeld*ed(d+eeode d(elekff
d,d-�Zpeqd.�ZrGd/d0�d0e�Zsd1eed2eedelfd3d4�ZtGd5d6�d6�Zue2d7�ZvGd8d9�d9e?�ZwdS):�N)�md5�sha1�sha256)�CookieError�Morsel�SimpleCookie)�MappingProxyType�
TracebackType)�
TYPE_CHECKING�Any�Callable�Dict�Iterable�List�Mapping�
NamedTuple�Optional�Tuple�Type�Union)�CIMultiDict�CIMultiDictProxy�	MultiDict�MultiDictProxy)�URL�)�hdrs�helpers�http�	multipart�payload)�AbstractStreamWriter)�ClientConnectionError�
ClientOSError�ClientResponseError�ContentTypeError�
InvalidURL�ServerFingerprintMismatch��
HAS_BROTLI)�FormData)�	_SENTINEL�BaseTimerContext�	BasicAuth�HeadersMixin�	TimerNoop�basicauth_from_netrc�netrc_from_env�noop�reify�
set_exception�
set_result)�SERVER_SOFTWARE�HttpVersion�
HttpVersion10�
HttpVersion11�StreamWriter)�
client_logger)�StreamReader)�DEFAULT_JSON_DECODER�JSONDecoder�LooseCookies�LooseHeaders�Query�
RawHeaders)�
SSLContext)�
ClientRequest�ClientResponse�RequestInfo�Fingerprint)�
ClientSession)�
Connection)�Tracez[^-!#$%&'*+.^_`|~0-9a-zA-Z]z!^application/(?:[\w.+-]+?\+)?json�returncCstrdSdS)Nzgzip, deflate, brz
gzip, deflater(�rLrL�@/usr/local/lib/python3.10/dist-packages/aiohttp/client_reqrep.py�_gen_default_accept_encodingd�rNT)�auto_attribs�frozen�slotsc@s.eZdZUeeed<ded<eeed<dS)�ContentDisposition�typezMappingProxyType[str, str]�
parameters�filenameN)�__name__�
__module__�__qualname__r�str�__annotations__rLrLrLrMrShs
rSc@s.eZdZUeed<eed<ded<eed<dS)�_RequestInfo�url�method�CIMultiDictProxy[str]�headers�real_urlN)rWrXrYrr[rZrLrLrLrMr\os

r\c@s.eZdZefdededddeddf
dd�Zd	S)
rFr]r^r`r_rarKcCs$t�|||||tur|f�S|f�S)zuCreate a new RequestInfo instance.

        For backwards compatibility, the real_url parameter is optional.
        )�tuple�__new__r+)�clsr]r^r`rarLrLrMrcxs
��zRequestInfo.__new__N)rWrXrYr+rrZrcrLrLrLrMrFvs������rFc@sPeZdZeeed�Zdeddfdd�Ze	defdd��Z
d	ejddfd
d�Z
dS)rG)��� �fingerprintrKNcCsHt|�}|j�|�}|std��|tus|turtd��||_||_dS)Nzfingerprint has invalid lengthz8md5 and sha1 are insecure and not supported. Use sha256.)�len�HASHFUNC_BY_DIGESTLEN�get�
ValueErrorrr�	_hashfunc�_fingerprint)�selfrh�	digestlen�hashfuncrLrLrM�__init__�s
zFingerprint.__init__cC�|jS�N)rn�rorLrLrMrh��zFingerprint.fingerprint�	transportcCs`|�d�sdS|�d�}|jdd�}|�|���}||jkr.|�d�^}}}t|j|||��dS)N�
sslcontext�
ssl_objectT)�binary_form�peername)�get_extra_info�getpeercertrm�digestrnr')rorw�sslobj�cert�got�host�port�_rLrLrM�check�s


�zFingerprint.check)rWrXrYrrrrj�bytesrr�propertyrh�asyncio�	Transportr�rLrLrLrMrG�s�
rG�sslrC�
verify_ssl�ssl_contextrhcCs�|durd}|dur|stjdtdd�|durtd��d}|dur4tjdtdd�|dur2td��|}|durLtjdtdd�|durHtd��t|�}t|t�sXtd	�|���|S)
NTz/verify_ssl is deprecated, use ssl=False instead���
stacklevelzNverify_ssl, ssl_context, fingerprint and ssl parameters are mutually exclusiveFz2ssl_context is deprecated, use ssl=context insteadzCfingerprint is deprecated, use ssl=Fingerprint(fingerprint) insteadzFssl should be SSLContext, bool, Fingerprint or None, got {!r} instead.)	�warnings�warn�DeprecationWarningrlrG�
isinstance�SSL_ALLOWED_TYPES�	TypeError�format)r�r�r�rhrLrLrM�_merge_ssl_params�sR������
�r�)�https�wssc@s`eZdZUeed<eeed<eed<ee	ee
fed<eeed<eeed<eeed<dS)	�
ConnectionKeyr�r��is_sslr��proxy�
proxy_auth�proxy_headers_hashN)
rWrXrYrZr[r�int�boolrrCrGrr-rLrLrLrMr��s
r��response_content_type�expected_content_typecCs|dkrt�|�duS||vS)N�application/json)�json_re�match)r�r�rLrLrM�_is_expected_content_type�sr�c0@s�eZdZUejejejejhZej	ej
ejhZe�
e��
ejh�Zejdeje�iZdZeed<dZdZdZdZdZeded<ddddddejddddddddddddddd	�d
ede de!d
ee"dee#ededee$dee%dej&de'ee(dfdee(de(dee)j*dee+ddee dee%dee,dedde'e-e(e.fdee"d ee/d!d"e(d#eef.d$d%�Z0ded&e1d'dfd(d)�Z2e3d'e4dfd*d+��Z5e3d'ed,fd-d.��Z6e6j7dfd0d.��Z6d'e(fd1d2�Z8e3d'e'd3e(e.ffd4d5��Z9e3d'e:fd6d7��Z;e3d'efd8d9��Z<e3d'ee=fd:d;��Z>e3d'e?fd<d=��Z@de d'dfd>d?�ZAde'ej&efd'dfd@dA�ZBd
ee"d'dfdBdC�ZCdee#ed'dfdDdE�ZDdee$d'dfdFdG�ZEded'dfdHdI�ZFdgdJdK�ZGdhdee%d"e(d'dfdLdM�ZHded'dfdNdO�ZIdhdPe(d'dfdQdR�ZJdee dee%dee"d'dfdSdT�ZKd/eLdUdVd'dfdWdX�ZMdidYdZ�ZNdgd[d\�ZOdgd]d^�ZPd
ede d_eQd'dfd`da�ZRd
ede d
dbd'dfdcdd�ZSdS)jrDz*/*��bodyNzCIMultiDict[None]�_skip_auto_headersFT)�paramsr`�skip_auto_headers�data�cookies�auth�version�compress�chunked�	expect100�loop�response_classr�r��timer�sessionr��
proxy_headers�traces�	trust_env�server_hostnamer^r]r�r`r�r�r�r�r�r�r�r�r�r�rEr�r�r�r�rHr�r�r�rJr�r�cCs�|
durt��}
t�|�}rtd|�d|���d���t|�tus&J|��|dur4t|�tus4J|��tr<|dus<J�||_	|rF|�
|�}||_|jrQ|�
d�n||_|��|_||_|
|_|
|_d|_|durlt}n|}||_|durw|nt�|_|dur�|nd|_||_|
��r�t�t�d��|_ |�!|	�|�"|�|�#|�|�$|�|�%|�|�&|�|�'||�|�(|||�|�)|�|dus�|j|j*vr�|�+�|�,|�|dur�g|_-dS||_-dS)Nz+Method cannot contain non-token characters z (found at least �)Tr).r��get_event_loop�_CONTAINS_CONTROL_CHAR_RE�searchrl�grouprTrr
�_session�extend_query�original_url�raw_fragment�
with_fragmentr]�upperr^r�r�r��lengthrEr�r/�_timer�_sslr��	get_debug�	traceback�
extract_stack�sys�	_getframe�_source_traceback�update_version�update_host�update_headers�update_auto_headers�update_cookies�update_content_encoding�update_auth�update_proxy�update_body_from_data�GET_METHODS�update_transfer_encoding�update_expect_continue�_traces)ror^r]r�r`r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��real_response_classrLrLrMrrsZ��









zClientRequest.__init__r�rKcC�
d|_dSrt��_ClientRequest__writer�ror�rLrLrM�__reset_writerl�
zClientRequest.__reset_writercCs|jpt�Srt)r�rrurLrLrMr�oszClientRequest.skip_auto_headers�asyncio.Task[None]cCrsrtr�rurLrLrM�_writersrvzClientRequest._writer�writercCs.|jdur|j�|j�||_|�|j�dSrt)r��remove_done_callback�_ClientRequest__reset_writer�add_done_callback�ror�rLrLrMr�ws
cCs|jjtvSrt)r]�scheme�_SSL_SCHEMESrurLrLrMr�~rOzClientRequest.is_sslrCcCrsrt)r�rurLrLrMr��rvzClientRequest.sslc
CsT|j}rtt|����}nd}|j}t�t|jpd|j|j	t
v|j|j|j
|f�S)N�)r��hashrb�itemsr]rcr��raw_hostr�r�r�r�r�r�)ror��hr]rLrLrM�connection_key�s
��zClientRequest.connection_keycCs|jj}|dus
J�|Srt)r]r�)ro�retrLrLrMr��szClientRequest.hostcCs|jjSrt)r]r�rurLrLrMr��szClientRequest.portcCs$t|j�}t�t|j|j||jf�Srt)rr`rbrcrFr]r^r�)ror`rLrLrM�request_info�s
�zClientRequest.request_infocCs<|jst|��|js
|jrt�|jpd|jpd�|_dSdS)z8Update destination host, port and connection type (ssl).r�N)	r�r&�raw_user�raw_passwordrr-�user�passwordr�)ror]rLrLrMr��s
�zClientRequest.update_hostcCsjt|t�r0dd�|�dd�D�}zt�t|d�t|d��}Wnty/td|���d�w||_dS)zdConvert request version to two elements tuple.

        parser HTTP version '1.1' => (1, 1)
        cSsg|]}|���qSrL)�strip)�.0�partrLrLrM�
<listcomp>�sz0ClientRequest.update_version.<locals>.<listcomp>�.rrz#Can not parse http version number: N)r�rZ�splitrr7r�rlr�)ror��vrLrLrMr��s
 ���
zClientRequest.update_versioncCs~t�|_|jj}|dusJ�||jtj<|sdSt|ttt	f�r$|�
�}|D]\}}|tjvr5||j|<q&|j�||�q&dS)zUpdate request headers.N)
rr`r]�host_port_subcomponentr�HOSTr��dictrrr��HOST_ALL�add)ror`r��key�valuerLrLrMr��s
�zClientRequest.update_headerscCs�|durtdd�t|�D��|_|j��}|�|j�n|j}|j��D]
\}}||vr1||j|<q$tj	|vr?t
|jtj	<dSdS)Ncss�|]}|dfVqdSrtrL)r��hdrrLrLrM�	<genexpr>�s�
�z4ClientRequest.update_auto_headers.<locals>.<genexpr>)r�sortedr�r`�copy�extend�DEFAULT_HEADERSr�r�
USER_AGENTr6)ror��used_headersr�valrLrLrMr��s
�

�
�z!ClientRequest.update_auto_headerscCs�|sdSt�}tj|jvr|�|j�tjd��|jtj=t|t�r'|��}n|}|D]$\}}t|t	�rK|�|j
t	��}|�|j
|j|j
�|||<q+|||<q+|jddd���|jtj<dS)zUpdate request cookies header.Nr��;)�header�sep)rr�COOKIEr`�loadrkr�rr�rr�setr�coded_value�outputr�)ror��c�iter_cookies�namer�mrsl_valrLrLrMr��s 





zClientRequest.update_cookiescCsb|sd|_dS|j�tj�r|jrtd��dS|jr/t|jt�s#d|_|j|jtj<d|_dSdS)zSet request content encoding.Nz9compress can not be set if Content-Encoding header is set�deflateT)	r�r`rkr�CONTENT_ENCODINGrlr�rZr�)ror�rLrLrMr�s��
�z%ClientRequest.update_content_encodingcCs�|j�tjd���}d|vr|jrtd��dS|jr,tj|jvr$td��d|jtj<dStj|jvr?tt	|j
��|jtj<dSdS)z!Analyze transfer-encoding header.r�r�zDchunked can not be set if "Transfer-Encoding: chunked" header is setz6chunked can not be set if Content-Length header is setN)r`rkr�TRANSFER_ENCODING�lowerr�rl�CONTENT_LENGTHrZrir�)ro�terLrLrMr�s ����z&ClientRequest.update_transfer_encodingcCs�|dur|j}|dur2|r2|jjdur2t�}t�t��t||jj�}Wd�n1s-wY|dur8dSt|t	j
�sBtd��|��|j
tj<dS)zSet basic auth.Nz%BasicAuth() tuple is required instead)r�r]r�r1�
contextlib�suppress�LookupErrorr0r�rr-r��encoder`r�
AUTHORIZATION)ror�r��	netrc_objrLrLrMr�4s�zClientRequest.update_authcCs�|durdSt|t�r|�}z
tjj|dd�}Wntjy't|��}Ynw||_|jsGtj	|j
vrG|j}durDt|�|j
tj	<nd|_|j
sLJ�|j
}|j
}|j
��D]\}}||vsg|durh||vrhqW|||<qWdS)N)�dispositionT)r�r*r �PAYLOAD_REGISTRYrkr#r�r�rrr`�sizerZr�r�)ror�r)r`�skip_headersrrrLrLrMr�Ds,
�

�z#ClientRequest.update_body_from_data�expectcCsN|r	d|jtj<ntj|jvr|jtj��dkrd}|r%|j��|_dSdS)Nz100-continueT)r`r�EXPECTrr��
create_future�	_continue)ror+rLrLrMr�cs�z$ClientRequest.update_expect_continuecCsd||_|durd|_d|_dS|rt|tj�std��||_|dur-t|ttf�s-t	|�}||_dS)Nz,proxy_auth must be None or BasicAuth() tuple)
r�r�r�r�rr-rlrrr)ror�r�r�rLrLrMr�os
�
zClientRequest.update_proxy�connrIc
�sh�|jdur|��IdH|jIdH|j}|dusJ�z.t|jtj�r.|j�|�IdHnt|jtt	f�r;|jf|_|jD]
}|�|�IdHq>Wn\t
y}}z'|}|jdup_t|tj
�}|rlt|jd|j���}t|||�WYd}~dSd}~wtjy�|���ty�}zt|td|���|�WYd}~dSd}~ww|��IdH|��dS)z-Support coroutines that yields bytes objects.NzCan not write request body for z4Failed to send bytes into the underlying connection )r.�drain�protocolr�r�r �Payload�writer��	bytearray�OSError�errnor��TimeoutErrorr#r]r4�CancelledError�close�	Exceptionr"�	write_eof�
start_timeout)ror�r/r1�chunk�underlying_exc�reraised_exc�exc_is_not_timeoutrLrLrM�write_bytes�sR�


��
������	zClientRequest.write_bytesc�sB�|jtjkr|jj}|dusJ�|�d|jj��}n|jr(|��s(t|j�}n|jj	}|j
}|dus5J�t||j|j
rFt�|j|j|j�nd|j
rTt�|j|j|j�ndd�}|jra|�|j�|jdurj|��|j|jvr�|jdus{tj|jvr�tj|jvr�d|jtj<|j}tj|jvr�|jjr�|tkr�d|jtj<n
|tkr�d|jtj<|j�d|�d|j �d|j!��}|�"||j�IdH|j#s�|j$dus�|j%r�|�&||�}t'j(d	kr�t)j*||jd
d�}	n|j�+|�}	|	�,�r�d}	n|	|_-n
|�.�|�/�d}	|j0}
|
du�sJ�|
|j|j1|	|j$|j2|j3|j
|j|j4d�	|_5|j5S)
N�:)�
on_chunk_sent�on_headers_sentzapplication/octet-streamr9z
keep-alive� z HTTP/r�)r��T)r��eager_start)r��continue100r�r�r�r�r�)6r^r�METH_CONNECTr]�host_subcomponentr�r�r�rZ�raw_path_qsr1r:r�r��	functools�partial�_on_chunk_request_sent�_on_headers_request_sentr��enable_compressionr��enable_chunking�POST_METHODSr��CONTENT_TYPEr`r��
CONNECTION�
_connector�force_closer9r8�major�minor�
write_headersr�r.�writing_pausedrAr��version_infor��Task�create_task�doner�r<�set_eofr�r�r�r�r��response)ror/�connect_host�pathr1r�r��status_line�coro�taskr�rLrLrM�send�s�����

� 
�zClientRequest.sendc�sf�|jdur1z	|jIdHWdStjy0tjdkr't��}r*|��r-�YdSYdSYdSwdS�N)r��)r�r�r8r�r[�current_task�
cancelling�rorerLrLrMr9s�


�����zClientRequest.closecCs:|jdur|j��s|j��|j�|j�d|_dSdSrt)r�r��	is_closed�cancelr�r�rurLrLrM�	terminate"s



�zClientRequest.terminater=c��&�|jD]}|�|||�IdHqdSrt)r��send_request_chunk_sent)ror^r]r=�tracerLrLrMrN)s�
�z$ClientRequest._on_chunk_request_sentzCIMultiDict[str]c�rort)r��send_request_headers)ror^r]r`rqrLrLrMrO-s�
�z&ClientRequest._on_headers_request_sentrt)r�r�rKN�rKN)F)r/rIrKrE)TrWrXrYr�METH_GET�	METH_HEAD�METH_OPTIONS�
METH_TRACEr��
METH_PATCH�	METH_POST�METH_PUTrR�union�METH_DELETE�ALL_METHODS�ACCEPT�ACCEPT_ENCODINGrNrr�rr[r�r`r�r.r�rrr9rZrrAr@rr?r-r7rr�r��AbstractEventLooprr,rCrGrrr�objectr�r�rr�r��setterr�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r!rArfr9rnr�rNrOrLrLrLrMrD�s
�������
��	�
���
���
�������
��
�O


���
���
�
1
`
����rD�Connection closedc@s�eZdZUdZeeed<dZeed<dZ	ee
ed<dZeed<dZ
eeed<dZee
ed<dZed	ed
<dZeed<dZeded
<dZeeed<dZeded<dZeejed<dZeded<dZdZdZdd�Z e!dege
fed<dZ"eded<de
de#dddedd e$d!e%d"e&d#d$e'j(d%dd&dfd'd(�Z)dd)e*d&dfd*d+�Z+e,d&edfd,d-��Z-e-j.dedd&dfd.d-��Z-e,d&efd/d0��Z/e/j.d1ed&dfd2d0��Z/e0d&e#fd3d4��Z1e0d&e#fd5d6��Z2e0d&e#fd7d8��Z3e0d&e
fd9d:��Z4e0d�d<d=��Z5e0d&efd>d?��Z6e0d&e%fd@dA��Z7e0d&ee8fdBdC��Z9e:fdDe;d&dfdEdF�Z<d&e
fdGdH�Z=e,d&edfdIdJ��Z>e0d&ed	fdKdL��Z?e0d�dNdO��Z@d�dQdR�ZAd�dSdT�ZBe,d&eCfdUdV��ZDd�dWdX�ZEd&e;fdYdZ�ZFe,d&eCfd[d\��ZGd�d]d^�ZHd�d_d`�ZId�dadb�ZJd�dcdd�ZKd�dedf�ZLd�dgdh�ZMd&efdidj�ZNd&e
fdkdl�ZOd�dnee
doe
d&e
fdpdq�ZPdeQdrds�dnee
dteRduee
d&e;fdvdw�ZSd�dxdy�ZTdzeeUeVd{eeVd|eeWd&dfd}d~�ZXdS)�rENr��status�reason�content�_body�_headersrL)rE.�_history�_raw_headersrI�_connection�_cookieszasyncio.Future[bool]r.r�rHr�TFcGsdS)N�utf-8rL)r�rLrLrM�<lambda>RszClientResponse.<lambda>�_resolve_charsetr��_ClientResponse__writerr^r]r�zOptional[asyncio.Task[None]]rHr�r�r�rJr�r�rKc
Cs�t|�tusJ�||_||_|jr|�d�n||_|dur ||_|dur'||_||_	|dur0|nt
�|_i|_||_
||_|	durH|	|_|	j|_|��rWt�t�d��|_dSdS)Nr)rTrr^�	_real_urlr�r��_urlr�r.�
_request_infor/r��_cacher��_loopr�r�r�r�r�r�r�r�)
ror^r]r�rHr�r�r�r�r�rLrLrMrrVs&�zClientResponse.__init__r�cCr�rt�r�r�rLrLrMr�}r�zClientResponse.__reset_writercCrs)z�The writer task for streaming data.

        _writer is only provided for backwards compatibility
        for subclasses that may need to access it.
        r�rurLrLrMr��szClientResponse._writercCsL|jdur|j�|j�||_|durdS|��rd|_dS|�|j�dS)z'Set the writer task for streaming data.N)r�r��_ClientResponse__reset_writerr^r�r�rLrLrMr��s

cCs|jdur	t�|_|jSrt)r�rrurLrLrMr��s
zClientResponse.cookiesr�cCs
||_dSrt)r�)ror�rLrLrMr��s
cCrsrt)r�rurLrLrMr]�rvzClientResponse.urlcCstjdtdd�|jS)NzDeprecated, use .url #1654�r�)r�r�r�r�rurLrLrM�url_obj�szClientResponse.url_objcCrsrt)r�rurLrLrMra�rvzClientResponse.real_urlcCs|jjdusJ�|jjSrt)r�r�rurLrLrMr��szClientResponse.hostr_cCrsrt)r�rurLrLrMr`�rvzClientResponse.headerscCrsrt)r�rurLrLrM�raw_headers�rvzClientResponse.raw_headerscCrsrt)r�rurLrLrMr��rvzClientResponse.request_infocCsF|j�tj�}|dur
dSt�|�\}}t|�}t�|�}t|||�Srt)	r�rkr�CONTENT_DISPOSITIONr�parse_content_dispositionr�content_disposition_filenamerS)ro�raw�disposition_type�
params_dctr�rVrLrLrM�content_disposition�s
z"ClientResponse.content_disposition�	_warningscCs�|jrdS|jdur>|j��|��|j��r@d|i}|jd|��tfi|��|dd�}|jr6|j|d<|j�	|�dSdSdS)N�sourcezUnclosed response zUnclosed response)�client_response�message�source_traceback)
�_closedr��release�_cleanup_writerr�r�r��ResourceWarningr��call_exception_handler)ror��kwargs�contextrLrLrM�__del__�s




�zClientResponse.__del__cCs`t��}t|j�}|jr|j�dd��d�}nd}td�||j	|�|d�t|j
|d�|��S)N�ascii�backslashreplace�Nonez<ClientResponse({}) [{} {}]>)�file)�io�StringIOrZr]r�r$�decode�printr�r�r`�getvalue)ro�out�ascii_encodable_url�ascii_encodable_reasonrLrLrM�__repr__�s"
����zClientResponse.__repr__cCrsrt)r�rurLrLrM�
connection�rvzClientResponse.connectioncCrs)z2A sequence of of responses, if redirects occurred.)r�rurLrLrM�history�szClientResponse.history�/MultiDictProxy[MultiDictProxy[Union[str, URL]]]c
Cs�d�|j�dg��}|stt��St�}t�d|�D][}t�d|�}|dur'q|��\}}|�d�dd�}t�}|D]}	t�d|	tj	�}|durJq;|��\}
}}}|�
|
|�q;|�d|�}
|�
d	|j�t
|���|�
t|
�t|��qt|�S)
Nz, �linkz	,(?=\s*<)z
\s*<(.*)>(.*)rrz%^\s*(\S*)\s*=\s*(['\"]?)(.*?)(\2)\s*$�relr])�joinr`�getallrr�rer�r��groups�Mrrkr]rrZ)
ro�	links_str�linksrr�r]�
params_strr�r��paramrr�rrLrLrMr��s*
zClientResponse.linksr�c	�sx�d|_|j|_||_|j�S	z|j}|��IdH\}}Wntjy:}zt|j	|j
|j|j|j
d�|�d}~ww|jdksJ|jdksJ|jdkrKn|jdurYt|jd�d|_qWd�n1sdwY|�|j�|j|_|j|_|j|_|j
|_|j|_||_|j
�tjd�}r�t�}|D]!}z|�|�Wq�ty�}zt� d	|�WYd}~q�d}~ww||_!|S)
zStart response processing.FTN�r�r�r`�d���erLz!Can not load response cookies: %s)"r�r1�	_protocolr�r��readr�HttpProcessingErrorr$r�r��coder�r`r.r5�on_eof�
_response_eofr�r�r�r�r�r�r�r�r�
SET_COOKIErrrr;�warningr�)	ror�r1r�r �exc�cookie_hdrsr�rrLrLrM�starts^�����	
����zClientResponse.startcCsD|jrdS|jo|jj}|dur|jrdSd|_|��|��dS�NT)r�r�r1�upgradedr��_release_connection)ror1rLrLrMr�NszClientResponse._response_eofcCrsrt)r�rurLrLrM�closed[rvzClientResponse.closedcCsV|js|��d|_|jdus|j��rdS|��|jdur)|j��d|_dSdSr�)�	_released�_notify_contentr�r�rlr�r�r9rurLrLrMr9_s


�zClientResponse.closecCs*|js|��d|_|��|��t�Sr�)r�r�r�r�r�r2rurLrLrMr�lszClientResponse.releasecCs
d|jkS)z�Returns ``True`` if ``status`` is less than ``400``, ``False`` if not.

        This is **not** a check for ``200 OK`` but a check that the response
        status is under 400.
        i�)r�rurLrLrM�okvs
zClientResponse.okcCsB|js|jdus
J�|js|��t|j|j|j|j|jd��dS)Nr�)	r�r��_in_contextr�r$r�r�r�r`rurLrLrM�raise_for_statuss��zClientResponse.raise_for_statuscsD�jdur �jdur�j��d�_dS�j��fdd��dSdS)Ncs���Srt)r�)�frurLrMr��sz4ClientResponse._release_connection.<locals>.<lambda>)r�r�r�r�rurLrurMr��s



�z"ClientResponse._release_connectionc��^�|jdur)z|jIdHWntjy(tjdkr&t��}r&|��r&�Ynw|��dSrg)r�r�r8r�r[rirjr�rkrLrLrM�_wait_released���


����zClientResponse._wait_releasedcCs|jdur
|j��d|_dSrt)r�rmr�rurLrLrMr��s


zClientResponse._cleanup_writercCs*|j}|r|��durt|t�d|_dSr�)r��	exceptionr4�_CONNECTION_CLOSED_EXCEPTIONr�)ror�rLrLrMr��s

zClientResponse._notify_contentc�r�rg)r�r�r8r�r[rirjr�rkrLrLrM�wait_for_close�r�zClientResponse.wait_for_closec�s��|jdur1z|j��IdH|_|jD]}|�|j|j|j�IdHqWnty0|���w|j	r8t
d��|jo>|jj}|dusF|j
sM|��IdH|jS)zRead response payload.Nr�)r�r�r�r��send_response_chunk_receivedr^r]�
BaseExceptionr9r�r"r�r1r�r�)rorqr1rLrLrMr��s&�

���zClientResponse.readcCs�|j�tjd���}t�|�}|j�d�}|r3t�	t
t��t�
|�jWd�S1s.wY|jdkrD|jdksB|jdkrDdS|jdurMtd��|�||j�S)Nr��charset�application�json�rdapr�z7Cannot compute fallback encoding of a not yet read body)r`rkrrSrr�parse_mimetyperUr!r"r#rl�codecs�lookuprrT�subtyper��RuntimeErrorr�)ro�ctype�mimetype�encodingrLrLrM�get_encoding�s

 �

�zClientResponse.get_encoding�strictr��errorsc�s:�|jdur
|��IdH|dur|��}|jj||d�S)z!Read response payload and decode.N)r�)r�r�r�r�)ror�r�rLrLrM�text�s�
zClientResponse.textr�)r��loads�content_typer�r�c�s��|jdur
|��IdH|r-|j�tjd���}t||�s-t|j	|j
|jd||jd��|j��}|s6dS|dur>|�
�}||�|��S)zRead and decodes JSON response.Nr�z3Attempt to decode JSON with unexpected mimetype: %sr�)r�r�r`rkrrSrr�r%r�r�r�r�r�r�)ror�r�r�r��strippedrLrLrMr��s&�

�

zClientResponse.jsonc�s�d|_|Sr�)r�rurLrLrM�
__aenter__s�zClientResponse.__aenter__�exc_type�exc_val�exc_tbc�s"�d|_|��|��IdHdS)NF)r�r�r�)ror�rrrLrLrM�	__aexit__s�zClientResponse.__aexit__rt)rKr_)rKr�)r�rIrKrErs)Nr�)rKrE)YrWrXrYr�rr7r[r�r�r�rZr�r<r�r�r�rr�rr�rBr�r�rr.r�r��StackSummaryr�r�r�r�r�rr�rr,rFrr�r�rrr�r�r�r�r�r�r3r]r�rar�r`r�r�rSr�r�rr�r�r�r�r�r�r�r�r�r9r�r�r�r�r�r�r�r�r�r�r�r=r>r�r�rr�r	rrLrLrLrMrE7s�
������	�
��
�'
	
#
6











����
�
!
����rE)xr�r�r!rLr�r�r�r�r��hashlibrrr�http.cookiesrrr�typesrr	�typingr
rrr
rrrrrrrr�attr�	multidictrrrr�yarlrr�rrrrr �abcr!�client_exceptionsr"r#r$r%r&r'�compression_utilsr)�formdatar*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:�logr;�streamsr<�typedefsr=r>r?r@rArBr�rC�ImportErrorr��__all__�clientrH�	connectorrI�tracingrJ�compiler�r�rZrN�srSr\rFrGr�rTr�r�r��	frozensetr�r�r�rDr�rErLrLrLrM�<module>s�8 4
 	�


 ����
�7��
�9