
    hg,                        d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 ddl
mZ erddlZej        Zn	 ddlZej        Zn# e$ r dxZZY nw xY werddlmZmZmZmZ ddlmZ ndxZxZxZZd	Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d dee          Z  G d dee!          Z" G d de"          Z# G d de#          Z$ G d  d!e#          Z% G d" d#e#          Z& G d$ d%e          Z' G d& d'e'          Z( G d( d)e'ej)                  Z* G d* d+e*          Z+ G d, d-e*          Z, G d. d/e'          Z- G d0 d1e          Z. G d2 d3ee/          Z0 G d4 d5e0          Z1 G d6 d7e          Z2 G d8 d9e          Z3 G d: d;e1e2          Z4 G d< d=e3e2          Z5 G d> d?e#          Z6e#ej7        fZ8e6ej7        fZ9ej:        fZ;e6ej:        fZ<n e=            Z8e6e/fZ9 e=            Z;e6fZ< G d@ dAge<R  Z> G dB dCge9R  Z? G dD dEe@          ZAdS )FzHTTP related errors.    N)TYPE_CHECKINGOptionalTupleUnion)MultiMapping   )StrOrURL)ClientResponseConnectionKeyFingerprintRequestInfo)RawResponseMessage)ClientErrorClientConnectionErrorClientConnectionResetErrorClientOSErrorClientConnectorErrorClientProxyConnectionErrorClientSSLErrorClientConnectorDNSErrorClientConnectorSSLErrorClientConnectorCertificateErrorConnectionTimeoutErrorSocketTimeoutErrorServerConnectionErrorServerTimeoutErrorServerDisconnectedErrorServerFingerprintMismatchClientResponseErrorClientHttpProxyErrorWSServerHandshakeErrorContentTypeErrorClientPayloadError
InvalidURLInvalidUrlClientErrorRedirectClientErrorNonHttpUrlClientErrorInvalidUrlRedirectClientErrorNonHttpUrlRedirectClientErrorWSMessageTypeErrorc                       e Zd ZdZdS )r   z(Base class for client connection errors.N__name__
__module____qualname____doc__     [/var/www/html/prod/cognitive/venv/lib/python3.11/site-packages/aiohttp/client_exceptions.pyr   r   =   s        2222r2   r   c                       e Zd ZdZddddddedeedf         dee         d	ee         d
e	dee
e	                  ddfdZde	fdZde	fdZedefd            Zej        deddfd            ZdS )r   a  Base 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 )codestatusmessageheadersrequest_infohistory.r6   r7   r8   r9   returnc                    || _         |-|t          d          t          j        dt          d           ||| _        n||| _        nd| _        || _        || _        || _        ||f| _	        d S )NzSBoth code and status arguments are provided; code is deprecated, use status insteadz/code argument is deprecated, use status instead   
stacklevelr   )
r:   
ValueErrorwarningswarnDeprecationWarningr7   r8   r9   r;   args)selfr:   r;   r6   r7   r8   r9   s          r3   __init__zClientResponseError.__init__K   s     )! =   MA"   
  DKKDKKDK!7+			r2   c                 r    d                     | j        | j        t          | j        j                            S )Nz{}, message={!r}, url={!r})formatr7   r8   strr:   real_urlrF   s    r3   __str__zClientResponseError.__str__l   s5    +22KL!*++
 
 	
r2   c                     | j         d| j        }| j        dk    r|d| j        z  }| j        dk    r|d| j        z  }| j        |d| j        z  }t          |           j         d| dS )	Nz, r   z	, status=r5   z
, message=z
, headers=())r:   r;   r7   r8   r9   typer-   )rF   rE   s     r3   __repr__zClientResponseError.__repr__s   s    #9999;!////D<21111D<#1111Dt**%//////r2   c                 H    t          j        dt          d           | j        S Nz/code property is deprecated, use status insteadr>   r?   rB   rC   rD   r7   rL   s    r3   r6   zClientResponseError.code}   s.    =	
 	
 	
 	

 {r2   valuec                 L    t          j        dt          d           || _        d S rT   rU   )rF   rV   s     r3   r6   zClientResponseError.code   s1    =	
 	
 	
 	

 r2   )r-   r.   r/   r0   r   r   r
   r   intrJ   r   rG   rM   rR   propertyr6   setterr1   r2   r3   r   r   A   s8         # $/3, , ,!, ~s*+,
 sm, , , ,s+,, 
, , , ,B
 
 
 
 
0# 0 0 0 0 c    X 
[# $    [  r2   r   c                       e Zd ZdZdS )r"   zContentType found is not valid.Nr,   r1   r2   r3   r"   r"      s        ))))r2   r"   c                       e Zd ZdZdS )r!   z!websocket server handshake error.Nr,   r1   r2   r3   r!   r!      s        ++++r2   r!   c                       e Zd ZdZdS )r    zHTTP proxy error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
    proxy responds with status other than ``200 OK``
    on ``CONNECT`` request.
    Nr,   r1   r2   r3   r    r       s           r2   r    c                       e Zd ZdZdS )TooManyRedirectsz%Client was redirected too many times.Nr,   r1   r2   r3   r_   r_      s        ////r2   r_   c                       e Zd ZdZdS )r   z$Base class for client socket errors.Nr,   r1   r2   r3   r   r              ....r2   r   c                       e Zd ZdZdS )r   ConnectionResetErrorNr,   r1   r2   r3   r   r      s        r2   r   c                       e Zd ZdZdS )r   zOSError error.Nr,   r1   r2   r3   r   r      s        r2   r   c                        e Zd ZdZdededdf fdZedefd            Zede	fd            Z
edee         fd	            Zedeeed
f         fd            Zde	fdZej        Z xZS )r   zClient connector error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        a connection can not be established.
    connection_keyos_errorr<   Nc                     || _         || _        t                                          |j        |j                   ||f| _        d S N)	_conn_key	_os_errorsuperrG   errnostrerrorrE   )rF   rf   rg   	__class__s      r3   rG   zClientConnectorError.__init__   s@    '!):;;;#X.			r2   c                     | j         S ri   )rk   rL   s    r3   rg   zClientConnectorError.os_error   s
    ~r2   c                     | j         j        S ri   rj   hostrL   s    r3   rs   zClientConnectorError.host       ~""r2   c                     | j         j        S ri   rj   portrL   s    r3   rw   zClientConnectorError.port   rt   r2   r   c                     | j         j        S ri   )rj   sslrL   s    r3   ry   zClientConnectorError.ssl   s    ~!!r2   c                 Z    d                     | | j        du rdn| j        | j                  S )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]TdefaultrI   ry   rn   rL   s    r3   rM   zClientConnectorError.__str__   s5    GNNtx4//))TXt}
 
 	
r2   )r-   r.   r/   r0   r   OSErrorrG   rY   rg   rJ   rs   r   rX   rw   r   
SSLContextboolry   rM   BaseException
__reduce____classcell__ro   s   @r3   r   r      s!        /} / /D / / / / / / '    X #c # # # X# #hsm # # # X# "U:t]:; " " " X"
 
 
 
 
 )JJJJJr2   r   c                       e Zd ZdZdS )r   zDNS resolution failed during client connection.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        DNS resolution fails.
    Nr,   r1   r2   r3   r   r                 r2   r   c                       e Zd ZdZdS )r   zProxy connection error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        connection to proxy can not be established.
    Nr,   r1   r2   r3   r   r      r   r2   r   c                   \     e Zd ZdZdedededdf fdZedefd            Z	defd	Z
 xZS )
UnixClientConnectorErrorzUnix connector error.

    Raised in :py:class:`aiohttp.connector.UnixConnector`
    if connection to unix socket can not be established.
    pathrf   rg   r<   Nc                 Z    || _         t                                          ||           d S ri   )_pathrl   rG   )rF   r   rf   rg   ro   s       r3   rG   z!UnixClientConnectorError.__init__   s,     
22222r2   c                     | j         S ri   )r   rL   s    r3   r   zUnixClientConnectorError.path   s
    zr2   c                 Z    d                     | | j        du rdn| j        | j                  S )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Tr{   r|   rL   s    r3   rM   z UnixClientConnectorError.__str__   s5    ELLtx4//))TXt}
 
 	
r2   )r-   r.   r/   r0   rJ   r   r}   rG   rY   r   rM   r   r   s   @r3   r   r      s         33)63BI3	3 3 3 3 3 3 c    X
 
 
 
 
 
 
 
 
r2   r   c                       e Zd ZdZdS )r   zServer connection errors.Nr,   r1   r2   r3   r   r              ####r2   r   c                   6    e Zd ZdZddeeedf         ddfdZdS )r   zServer disconnected.Nr8   r<   c                 ,    |d}|f| _         || _        d S )NzServer disconnected)rE   r8   )rF   r8   s     r3   rG   z ServerDisconnectedError.__init__  s     ?+GJ	r2   ri   )r-   r.   r/   r0   r   r   rJ   rG   r1   r2   r3   r   r     sO         &8#t&C D PT      r2   r   c                       e Zd ZdZdS )r   zServer timeout error.Nr,   r1   r2   r3   r   r             r2   r   c                       e Zd ZdZdS )r   zConnection timeout error.Nr,   r1   r2   r3   r   r     r   r2   r   c                       e Zd ZdZdS )r   zSocket timeout error.Nr,   r1   r2   r3   r   r     r   r2   r   c            
       :    e Zd ZdZdededededdf
dZdefd	ZdS )
r   z4SSL certificate does not match expected fingerprint.expectedgotrs   rw   r<   Nc                 T    || _         || _        || _        || _        ||||f| _        d S ri   )r   r   rs   rw   rE   )rF   r   r   rs   rw   s        r3   rG   z"ServerFingerprintMismatch.__init__  s2     		sD$/			r2   c                 p    d                     | j        j        | j        | j        | j        | j                  S )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)rI   ro   r-   r   r   rs   rw   rL   s    r3   rR   z"ServerFingerprintMismatch.__repr__#  s2    @GGN#T]DHdi
 
 	
r2   )	r-   r.   r/   r0   bytesrJ   rX   rG   rR   r1   r2   r3   r   r     sl        >>0 0U 0# 0S 0T 0 0 0 0
# 
 
 
 
 
 
r2   r   c                       e Zd ZdZdS )r#   zResponse payload error.Nr,   r1   r2   r3   r#   r#   )  s        !!!!r2   r#   c                        e Zd ZdZddedeedf         ddf fdZedefd            Z	edd	            Z
defd
ZdefdZ xZS )r$   zbInvalid URL.

    URL used for fetching is malformed, e.g. it doesn't contains host
    part.
    Nurldescriptionr<   c                     || _         || _        |r$t                                          ||           d S t                                          |           d S ri   )_url_descriptionrl   rG   )rF   r   r   ro   s      r3   rG   zInvalidURL.__init__6  sZ     	' 	"GGS+.....GGS!!!!!r2   c                     | j         S ri   )r   rL   s    r3   r   zInvalidURL.urlA  s
    yr2   
str | Nonec                     | j         S ri   )r   rL   s    r3   r   zInvalidURL.descriptionE  s      r2   c                 (    d| j         j         d|  dS )N< >)ro   r-   rL   s    r3   rR   zInvalidURL.__repr__I  s     44>*44T4444r2   c                 Z    | j         r| j         d| j          S t          | j                  S )Nz - )r   r   rJ   rL   s    r3   rM   zInvalidURL.__str__L  s4     	8i77D$577749~~r2   ri   )r<   r   )r-   r.   r/   r0   r	   r   rJ   rG   rY   r   r   rR   rM   r   r   s   @r3   r$   r$   -  s         	" 	"H 	"5d3C 	"t 	" 	" 	" 	" 	" 	" X    X ! ! ! X!5# 5 5 5 5        r2   r$   c                       e Zd ZdZdS )r%   zInvalid URL client error.Nr,   r1   r2   r3   r%   r%   R  r   r2   r%   c                       e Zd ZdZdS )r&   zClient redirect error.Nr,   r1   r2   r3   r&   r&   V  s            r2   r&   c                       e Zd ZdZdS )r'   zNon http URL client error.Nr,   r1   r2   r3   r'   r'   Z  s        $$$$r2   r'   c                       e Zd ZdZdS )r(   z"Invalid URL redirect client error.Nr,   r1   r2   r3   r(   r(   ^  s        ,,,,r2   r(   c                       e Zd ZdZdS )r)   z#Non http URL redirect client error.Nr,   r1   r2   r3   r)   r)   b  s        ----r2   r)   c                       e Zd ZdZdS )r   zBase error for ssl.*Errors.Nr,   r1   r2   r3   r   r   f  s        %%%%r2   r   c                       e Zd ZdZdS )r   zResponse ssl error.Nr,   r1   r2   r3   r   r   ~  s        r2   r   c                       e Zd ZdZdededdfdZedefd            Zede	fd            Z
edee         fd	            Zedefd
            Zde	fdZdS )r   zResponse certificate error.rf   certificate_errorr<   Nc                 4    || _         || _        ||f| _        d S ri   )rj   _certificate_errorrE   )rF   rf   r   s      r3   rG   z(ClientConnectorCertificateError.__init__  s$     ("3#%67			r2   c                     | j         S ri   )r   rL   s    r3   r   z1ClientConnectorCertificateError.certificate_error  s    &&r2   c                     | j         j        S ri   rr   rL   s    r3   rs   z$ClientConnectorCertificateError.host  rt   r2   c                     | j         j        S ri   rv   rL   s    r3   rw   z$ClientConnectorCertificateError.port  rt   r2   c                     | j         j        S ri   )rj   is_sslrL   s    r3   ry   z#ClientConnectorCertificateError.ssl  s    ~$$r2   c                 ,    d                     |           S )Nz{Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} [{0.certificate_error.__class__.__name__}: {0.certificate_error.args}])rI   rL   s    r3   rM   z'ClientConnectorCertificateError.__str__  s    **0&,,	
r2   )r-   r.   r/   r0   r   	ExceptionrG   rY   r   rJ   rs   r   rX   rw   r   ry   rM   r1   r2   r3   r   r     s       %%8+8@I8	8 8 8 8 '9 ' ' ' X' #c # # # X# #hsm # # # X# %T % % % X%
 
 
 
 
 
 
r2   r   c                       e Zd ZdZdS )r*   z$WebSocket message type is not valid.Nr,   r1   r2   r3   r*   r*     ra   r2   r*   )Br0   asynciorB   typingr   r   r   r   	multidictr   typedefsr	   ry   r~   ImportErrorclient_reqrepr
   r   r   r   http_parserr   __all__r   r   r   r"   r!   r    r_   r   rc   r   r}   r   r   r   r   r   r   r   TimeoutErrorr   r   r   r   r#   rA   r$   r%   r&   r'   r(   r)   r   CertificateErrorcert_errorscert_errors_basesSSLError
ssl_errorsssl_error_basestupler   r   	TypeErrorr*   r1   r2   r3   <module>r      s       8 8 8 8 8 8 8 8 8 8 8 8 " " " " " "       
 JJJJJ 


^

      jjj   MVVVVVVVVVVVV///////HLLKL.L=3E@3 3 3 3 3) 3 3 3L L L L L+ L L L^* * * * ** * * *, , , , ,0 , , ,    .   0 0 0 0 0* 0 0 0/ / / / /K / / /    !68L       )7   #* #* #* #* #*= #* #* #*L    2       !5   
 
 
 
 
3 
 
 
.$ $ $ $ $1 $ $ $    3            .0D      $ $ $ $ $/ $ $ $         +      
 
 
 
 
 5 
 
 
 " " " " " " " "" " " " "j " " "J$ $ $ $ $J $ $ $! ! ! ! !+ ! ! !% % % % %K % % %- - - - -$9;N - - -. . . . .$9;N . . .& & & & &) & & & ?')K
 ,J%s|4OO%''K
 J%'O         
 
 
 
 
 
'8 
 
 
 
D/ / / / / / / / / /s   > 	A
	A
