wce$*dZddlZddlZddlmZmZmZmZmZddl m Z ddl m Z  ddl Z e jZer ddlmZmZmZmZndxZxZZdZGd d eZGd d eZGd deZGddeZGddeZGddeZGddeZGddeeZGddeZ Gdde Z!Gdde Z"Gdd eZ#Gd!d"e#Z$Gd#d$e#ejJZ&Gd%d&e#Z'Gd'd(eZ(Gd)d*ee)Z*Gd+d,e Z+e 7e jXfZ-e+e jXfZ.e j^fZ0e+e j^fZ1ne2Z-e+e)fZ.e2Z0e+fZ1Gd-d.ge1Z3Gd/d0ge.Z4y#e$rdxZ ZY[wxYw)1zHTTP related errors.N) TYPE_CHECKINGAnyOptionalTupleUnion)RawResponseMessage) LooseHeaders)ClientResponse ConnectionKey Fingerprint RequestInfo) ClientErrorClientConnectionError ClientOSErrorClientConnectorErrorClientProxyConnectionErrorClientSSLErrorClientConnectorSSLErrorClientConnectorCertificateErrorServerConnectionErrorServerTimeoutErrorServerDisconnectedErrorServerFingerprintMismatchClientResponseErrorClientHttpProxyErrorWSServerHandshakeErrorContentTypeErrorClientPayloadError InvalidURLceZdZdZy)rz(Base class for client connection errors.N__name__ __module__ __qualname____doc__;/usr/lib/python3/dist-packages/aiohttp/client_exceptions.pyrr-s2r(rceZdZdZddddddedeedfdeed eed e d ee d dfd Z d e fdZ d e fdZ ed efdZej ded dfdZy)raBase class for exceptions that occur after getting a response. request_info: An instance of RequestInfo. history: A sequence of responses, if redirects occurred. status: HTTP status code. message: Error message. headers: Response headers. N)codestatusmessageheaders request_infohistory.r,r-r.r/returnc||_|)| tdtjdtd|||_n|||_nd|_||_||_||_||f|_ y)NzSBoth code and status arguments are provided; code is deprecated, use status insteadz/code argument is deprecated, use status instead stacklevelr) r0 ValueErrorwarningswarnDeprecationWarningr-r.r/r1args)selfr0r1r,r-r.r/s r)__init__zClientResponseError.__init__;s)  ! = MMA"    DK  DKDK   !7+ r(cxdj|j|j|jjS)Nz{}, message={!r}, url={!r})formatr-r.r0real_urlr<s r)__str__zClientResponseError.__str__\s2+22 KK LL    & &  r(c.|jd|j}|jdk7r|d|jz }|jdk7r|d|jz }|j|d|jz }t |j d|dS) Nz, rz , status=r+z , message=z , headers=())r0r1r-r.r/typer#)r<r;s r)__repr__zClientResponseError.__repr__cs##&b(89 ;;!  i / /D <<2  j 01 1D << # j 01 1Dt*%%&avQ//r(cRtjdtd|jSNz/code property is deprecated, use status insteadr4r5r8r9r:r-rAs r)r,zClientResponseError.codems# =  {{r(valuecJtjdtd||_yrIrJ)r<rKs r)r,zClientResponseError.codevs  =   r()r#r$r%r&rrr rintstrr r=rBrGpropertyr,setterr'r(r)rr1s# $*.,!,~s*+, sm ,  ,,,', ,B  0#0c [[#$r(rceZdZdZy)rzContentType found is not valid.Nr"r'r(r)rrs)r(rceZdZdZy)rz!websocket server handshake error.Nr"r'r(r)rrs+r(rceZdZdZy)rzHTTP proxy error. Raised in :class:`aiohttp.connector.TCPConnector` if proxy responds with status other than ``200 OK`` on ``CONNECT`` request. Nr"r'r(r)rrsr(rceZdZdZy)TooManyRedirectsz%Client was redirected too many times.Nr"r'r(r)rUrUs/r(rUceZdZdZy)rz$Base class for client socket errors.Nr"r'r(r)rrs.r(rceZdZdZy)rzOSError error.Nr"r'r(r)rrsr(rceZdZdZdededdffd ZedefdZede fdZ ede e fd Z edeeded ffd Zde fd Zej(ZxZS) rzClient connector error. Raised in :class:`aiohttp.connector.TCPConnector` if a connection can not be established. connection_keyos_errorr2Nc|||_||_t| |j|j ||f|_yN) _conn_key _os_errorsuperr=errnostrerrorr;)r<rYrZ __class__s r)r=zClientConnectorError.__init__s6'! ):):;#X. r(c|jSr\)r^rAs r)rZzClientConnectorError.os_errors ~~r(c.|jjSr\r]hostrAs r)rfzClientConnectorError.host~~"""r(c.|jjSr\r]portrAs r)rjzClientConnectorError.portrgr(r c.|jjSr\)r]sslrAs r)rlzClientConnectorError.ssls~~!!!r(cdj||j|j|jSd|jS)Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]defaultr?rlrarAs r)rBzClientConnectorError.__str__s@GNN dhh2$((4==  8A4==  r()r#r$r%r&r OSErrorr=rOrZrNrfrrMrjr SSLContextboolrlrB BaseException __reduce__ __classcell__rbs@r)rrs /}//D/ '#c###hsm##"U:tT=@A""  ))Jr(rceZdZdZy)rzProxy connection error. Raised in :class:`aiohttp.connector.TCPConnector` if connection to proxy can not be established. Nr"r'r(r)rrsr(rcVeZdZdZdedededdffd ZedefdZ defd Z xZ S) UnixClientConnectorErrorzUnix connector error. Raised in :py:class:`aiohttp.connector.UnixConnector` if connection to unix socket can not be established. pathrYrZr2Nc4||_t| ||yr\)_pathr_r=)r<rzrYrZrbs r)r=z!UnixClientConnectorError.__init__s  2r(c|jSr\)r|rAs r)rzzUnixClientConnectorError.paths zzr(cdj||j|j|jSd|jS)Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]rnrorAs r)rBz UnixClientConnectorError.__str__s@ELL dhh2$((4==  8A4==  r() r#r$r%r&rNr rpr=rOrzrBrurvs@r)ryrysT 33)63BI3 3 c  r(ryceZdZdZy)rzServer connection errors.Nr"r'r(r)rrs#r(rc.eZdZdZddeeedfddfdZy)rzServer disconnected.Nr.r2c*|d}|f|_||_y)NzServer disconnected)r;r.)r<r.s r)r=z ServerDisconnectedError.__init__s ?+GJ  r(r\)r#r$r%r&rr rNr=r'r(r)rrs&&8#t&C DPTr(rceZdZdZy)rzServer timeout error.Nr"r'r(r)rrsr(rc 8eZdZdZdededededdf dZdefd Zy) rz4SSL certificate does not match expected fingerprint.expectedgotrfrjr2NcR||_||_||_||_||||f|_yr\)rrrfrjr;)r<rrrfrjs r)r=z"ServerFingerprintMismatch.__init__s.    sD$/ r(cdj|jj|j|j|j |j S)Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)r?rbr#rrrfrjrAs r)rGz"ServerFingerprintMismatch.__repr__s:@GG NN # #T]]DHHdii  r() r#r$r%r&bytesrNrMr=rGr'r(r)rrs9>00U0#0S0T0 # r(rceZdZdZy)rzResponse payload error.Nr"r'r(r)rrs!r(rcNeZdZdZdeddffd ZedefdZdefdZ xZ S)r zbInvalid URL. URL used for fetching is malformed, e.g. it doesn't contains host part. urlr2Nc$t||yr\)r_r=)r<rrbs r)r=zInvalidURL.__init__s r(c |jdS)Nr)r;rAs r)rzInvalidURL.urlsyy|r(cPd|jjd|jdS)N< >)rbr#rrAs r)rGzInvalidURL.__repr__s&4>>**+1TXXJa88r() r#r$r%r&rr=rOrrNrGrurvs@r)r r sBCD S9#9r(r ceZdZdZy)rzBase error for ssl.*Errors.Nr"r'r(r)rrs%r(rceZdZdZy)rzResponse ssl error.Nr"r'r(r)rr7sr(rceZdZdZdededdfdZedefdZede fdZ ede e fd Z edefd Zde fd Zy) rzResponse certificate error.rYcertificate_errorr2Nc2||_||_||f|_yr\)r]_certificate_errorr;)r<rYrs r)r=z(ClientConnectorCertificateError.__init__>s ("3#%67 r(c|jSr\)rrAs r)rz1ClientConnectorCertificateError.certificate_errorEs&&&r(c.|jjSr\rerAs r)rfz$ClientConnectorCertificateError.hostIrgr(c.|jjSr\rirAs r)rjz$ClientConnectorCertificateError.portMrgr(c.|jjSr\)r]is_sslrAs r)rlz#ClientConnectorCertificateError.sslQs~~$$$r(c$dj|S)Nz{Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} [{0.certificate_error.__class__.__name__}: {0.certificate_error.args}])r?rAs r)rBz'ClientConnectorCertificateError.__str__Us **0&, r()r#r$r%r&r Exceptionr=rOrrNrfrrMrjrrrlrBr'r(r)rr;s%8+8@I8 8'9''#c###hsm##%T%%  r(r)5r&asyncior8typingrrrrr http_parserr typedefsr rlrq ImportError client_reqrepr r r r__all__rrrrrrrUrrprrrryrr TimeoutErrorrrrr7r rCertificateError cert_errorscert_errors_basesSSLError ssl_errorsssl_error_basestuplerrr'r(r)rs==+"J VV377K7.= ,3)3L+L^***,0,.0*0/K/)7#*=#*L!5 3 .$1$3 .0D0D   5  ""9j9,&)&?'')K  ,,J%s||4O'K J%'O '8 [ C*sF FF