U '7`Q!@s(dZddlZddlZddlmZmZmZmZmZddl m Z zddl Z e j Z Wne k rjdZ Z YnXerddlmZmZmZmZn dZZZdZGdd d eZGd d d eZGd d d eZGdddeZGdddeZGdddeZGdddeZGdddeeZGdddeZGdddeZGdddeZ Gddde Z!Gd d!d!e ej"Z#Gd"d#d#e Z$Gd$d%d%eZ%Gd&d'd'ee&Z'Gd(d)d)eZ(e dk re j)fZ*e(e j)fZ+e j,fZ-e(e j,fZ.ne/Z*e(e&fZ+e/Z-e(fZ.Gd*d+d+fe.Z0Gd,d-d-fe+Z1dS).zHTTP related errors.N) TYPE_CHECKINGAnyOptionalTupleUnion) LooseHeaders)ClientResponse ConnectionKey Fingerprint RequestInfo) ClientErrorClientConnectionError ClientOSErrorClientConnectorErrorClientProxyConnectionErrorClientSSLErrorClientConnectorSSLErrorClientConnectorCertificateErrorServerConnectionErrorServerTimeoutErrorServerDisconnectedErrorServerFingerprintMismatchClientResponseErrorClientHttpProxyErrorWSServerHandshakeErrorContentTypeErrorClientPayloadError InvalidURLc@seZdZdZdS)r z(Base class for client connection errors.N__name__ __module__ __qualname____doc__r$r$L/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/client_exceptions.pyr ,sr c @seZdZdZdddddeeedfeeeee ee ddddZ e d d d Z e d d d Z eed ddZejeddddZdS)rzYConnection error during reading response. request_info: instance of RequestInfo N)codestatusmessageheaders.) request_infohistoryr'r(r)r*returncCst||_|dk r.|dk rtdtjdtdd|dk r>||_n|dk rN||_nd|_||_||_||_||f|_ dS)NzSBoth code and status arguments are provided; code is deprecated, use status insteadz/code argument is deprecated, use status instead stacklevelr) r+ ValueErrorwarningswarnDeprecationWarningr(r)r*r,args)selfr+r,r'r(r)r*r$r$r%__init__6s( zClientResponseError.__init__r-cCsd|j|j|jjS)Nz{}, message={!r}, url={!r})formatr(r)r+Zreal_urlr6r$r$r%__str__Ws zClientResponseError.__str__cCsr|jd|j}|jdkr,|d|j7}|jdkrF|d|j7}|jdk r`|d|j7}dt|j|S)Nz, rz , status=r&z , message=z , headers=z{}({}))r+r,r(r)r*r9typer )r6r5r$r$r%__repr__^s   zClientResponseError.__repr__cCstjdtdd|jSNz/code property is deprecated, use status insteadr.r/r2r3r4r(r:r$r$r%r'hs zClientResponseError.code)valuer-cCstjdtdd||_dSr>r?)r6r@r$r$r%r'qs )r r!r"r#r rr rintstrrr7r;r=propertyr'setterr$r$r$r%r0s(   ! rc@seZdZdZdS)rzContentType found is not valid.Nrr$r$r$r%r{src@seZdZdZdS)rz!websocket server handshake error.Nrr$r$r$r%rsrc@seZdZdZdS)rzHTTP proxy error. Raised in :class:`aiohttp.connector.TCPConnector` if proxy responds with status other than ``200 OK`` on ``CONNECT`` request. Nrr$r$r$r%rsrc@seZdZdZdS)TooManyRedirectsz%Client was redirected too many times.Nrr$r$r$r%rEsrEc@seZdZdZdS)rz$Base class for client socket errors.Nrr$r$r$r%rsrc@seZdZdZdS)rzOSError error.Nrr$r$r$r%rsrcseZdZdZeeddfdd ZeedddZee dd d Z ee e dd d Z eeeded fdddZe dddZejZZS)rzClient connector error. Raised in :class:`aiohttp.connector.TCPConnector` if connection to proxy can not be established. N)connection_keyos_errorr-cs,||_||_t|j|j||f|_dSN) _conn_key _os_errorsuperr7errnostrerrorr5)r6rFrG __class__r$r%r7szClientConnectorError.__init__r8cCs|jSrH)rJr:r$r$r%rGszClientConnectorError.os_errorcCs|jjSrHrIhostr:r$r$r%rQszClientConnectorError.hostcCs|jjSrHrIportr:r$r$r%rSszClientConnectorError.portr cCs|jjSrH)rIsslr:r$r$r%rTszClientConnectorError.sslcCs d||jdk r|jnd|jS)Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]default)r9rTrMr:r$r$r%r;s zClientConnectorError.__str__)r r!r"r#r OSErrorr7rCrGrBrQrrArSr SSLContextboolrTr; BaseException __reduce__ __classcell__r$r$rNr%rsrc@seZdZdZdS)rzProxy connection error. Raised in :class:`aiohttp.connector.TCPConnector` if connection to proxy can not be established. Nrr$r$r$r%rsrc@seZdZdZdS)rzServer connection errors.Nrr$r$r$r%rsrc@s&eZdZdZdeeddddZdS)rzServer disconnected.N)r)r-cCs|dkr d}|f|_||_dS)NzServer disconnected)r5r))r6r)r$r$r%r7sz ServerDisconnectedError.__init__)N)r r!r"r#rrBr7r$r$r$r%rsrc@seZdZdZdS)rzServer timeout error.Nrr$r$r$r%rsrc@s4eZdZdZeeeeddddZedddZdS) rz4SSL certificate does not match expected fingerprint.N)expectedgotrQrSr-cCs*||_||_||_||_||||f|_dSrH)r\r]rQrSr5)r6r\r]rQrSr$r$r%r7s z"ServerFingerprintMismatch.__init__r8cCsd|jj|j|j|j|jS)Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)r9rOr r\r]rQrSr:r$r$r%r=sz"ServerFingerprintMismatch.__repr__) r r!r"r#bytesrBrAr7r=r$r$r$r%rsrc@seZdZdZdS)rzResponse payload error.Nrr$r$r$r%rsrcsHeZdZdZeddfdd ZeedddZedd d Z Z S) rz]Invalid URL. URL used for fetching is malformed, e.g. it doesn't contains host part.N)urlr-cst|dSrH)rKr7)r6r_rNr$r%r7szInvalidURL.__init__r8cCs |jdS)Nr)r5r:r$r$r%r_szInvalidURL.urlcCsd|jjd|jdS)N< >)rOr r_r:r$r$r%r=szInvalidURL.__repr__) r r!r"r#rr7rCr_rBr=r[r$r$rNr%rs rc@seZdZdZdS)rzBase error for ssl.*Errors.Nrr$r$r$r%rsrc@seZdZdZdS)rzResponse ssl error.Nrr$r$r$r%rsrc@s|eZdZdZeeddddZeedddZee dd d Z ee e dd d Z eedd dZe dddZdS)rzResponse certificate error.N)rFcertificate_errorr-cCs||_||_||f|_dSrH)rI_certificate_errorr5)r6rFrcr$r$r%r7!sz(ClientConnectorCertificateError.__init__r8cCs|jSrH)rdr:r$r$r%rc(sz1ClientConnectorCertificateError.certificate_errorcCs|jjSrHrPr:r$r$r%rQ,sz$ClientConnectorCertificateError.hostcCs|jjSrHrRr:r$r$r%rS0sz$ClientConnectorCertificateError.portcCs|jjSrH)rIZis_sslr:r$r$r%rT4sz#ClientConnectorCertificateError.sslcCs d|S)Nz{Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} [{0.certificate_error.__class__.__name__}: {0.certificate_error.args}])r9r:r$r$r%r;8sz'ClientConnectorCertificateError.__str__)r r!r"r#r Exceptionr7rCrcrBrQrrArSrXrTr;r$r$r$r%rs r)2r#Zasyncior2typingrrrrrZtypedefsrrTrW ImportErrorZ client_reqrepr r r r __all__rer rrrrrErrVrrrrr TimeoutErrorrrrr1rrZCertificateErrorZ cert_errorsZcert_errors_basesZSSLErrorZ ssl_errorsZssl_error_basestuplerrr$r$r$r%sZ   K &