
    f)                        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mZ 	 ddlZej                  ZerddlmZmZmZmZ nd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      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jJ                        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/ d0e,      Z- G d1 d2e      Z. G d3 d4e      Z/ G d5 d6e-e.      Z0 G d7 d8e/e.      Z1 G d9 d:e       Z2e7ejf                  fZ4e2ejf                  fZ5ejl                  fZ7e2ejl                  fZ8n e9       Z4e2e+fZ5 e9       Z7e2fZ8 G d; d<ge8 Z: G d= d>ge5 Z;y# e$ r dxZZY w xY w)?zHTTP related errors.    N)TYPE_CHECKINGOptionalTupleUnion   )RawResponseMessage)LooseHeadersStrOrURL)ClientResponseConnectionKeyFingerprintRequestInfo)ClientErrorClientConnectionErrorClientOSErrorClientConnectorErrorClientProxyConnectionErrorClientSSLErrorClientConnectorSSLErrorClientConnectorCertificateErrorConnectionTimeoutErrorSocketTimeoutErrorServerConnectionErrorServerTimeoutErrorServerDisconnectedErrorServerFingerprintMismatchClientResponseErrorClientHttpProxyErrorWSServerHandshakeErrorContentTypeErrorClientPayloadError
InvalidURLInvalidUrlClientErrorRedirectClientErrorNonHttpUrlClientErrorInvalidUrlRedirectClientErrorNonHttpUrlRedirectClientErrorc                       e Zd ZdZy)r   z(Base class for client connection errors.N__name__
__module____qualname____doc__     X/opt/lhia/ganansol/python/venv/lib/python3.12/site-packages/aiohttp/client_exceptions.pyr   r   4   s    2r/   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
   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y)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.r3   r4   r5   r6   returnc                    || _         |)|t        d      t        j                  dt        d       ||| _        n||| _        nd| _        || _        || _        || _        ||f| _	        y )NzSBoth code and status arguments are provided; code is deprecated, use status insteadz/code argument is deprecated, use status instead   
stacklevelr   )
r7   
ValueErrorwarningswarnDeprecationWarningr4   r5   r6   r8   args)selfr7   r8   r3   r4   r5   r6   s          r0   __init__zClientResponseError.__init__B   s     )! =  MMA"
  DKDKDK!7+	r/   c                     dj                  | j                  | j                  t        | j                  j
                              S )Nz{}, message={!r}, url={!r})formatr4   r5   strr7   real_urlrC   s    r0   __str__zClientResponseError.__str__c   s7    +22KKLL!!**+
 	
r/   c                 .   | j                   d| j                  }| j                  dk7  r|d| j                  z  }| j                  dk7  r|d| j                  z  }| j                  |d| j                  z  }t        |       j                   d| dS )	Nz, r   z	, status=r2   z
, message=z
, headers=())r7   r8   r4   r5   r6   typer*   )rC   rB   s     r0   __repr__zClientResponseError.__repr__j   s    ##&b(89;;!i//D<<2j 011D<<#j 011Dt*%%&avQ//r/   c                 R    t        j                  dt        d       | j                  S Nz/code property is deprecated, use status insteadr;   r<   r?   r@   rA   r4   rI   s    r0   r3   zClientResponseError.codet   s#    =	

 {{r/   valuec                 J    t        j                  dt        d       || _        y rQ   rR   )rC   rS   s     r0   r3   zClientResponseError.code}   s     =	

 r/   )r*   r+   r,   r-   r   r   r   r   intrG   r	   rD   rJ   rO   propertyr3   setterr.   r/   r0   r   r   8   s     # $*.,!, ~s*+,
 sm, , , ,', 
,B
 
0# 0 c   
[[# $  r/   r   c                       e Zd ZdZy)r    zContentType found is not valid.Nr)   r.   r/   r0   r    r       s    )r/   r    c                       e Zd ZdZy)r   z!websocket server handshake error.Nr)   r.   r/   r0   r   r      s    +r/   r   c                       e Zd ZdZy)r   zHTTP proxy error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
    proxy responds with status other than ``200 OK``
    on ``CONNECT`` request.
    Nr)   r.   r/   r0   r   r      s    r/   r   c                       e Zd ZdZy)TooManyRedirectsz%Client was redirected too many times.Nr)   r.   r/   r0   r\   r\      s    /r/   r\   c                       e Zd ZdZy)r   z$Base class for client socket errors.Nr)   r.   r/   r0   r   r      s    .r/   r   c                       e Zd ZdZy)r   zOSError error.Nr)   r.   r/   r0   r   r      s    r/   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_errorr9   Nc                 |    || _         || _        t        |   |j                  |j
                         ||f| _        y N)	_conn_key	_os_errorsuperrD   errnostrerrorrB   )rC   r`   ra   	__class__s      r0   rD   zClientConnectorError.__init__   s6    '!):):;#X.	r/   c                     | j                   S rc   )re   rI   s    r0   ra   zClientConnectorError.os_error   s    ~~r/   c                 .    | j                   j                  S rc   rd   hostrI   s    r0   rm   zClientConnectorError.host       ~~"""r/   c                 .    | j                   j                  S rc   rd   portrI   s    r0   rq   zClientConnectorError.port   rn   r/   r   c                 .    | j                   j                  S rc   )rd   sslrI   s    r0   rs   zClientConnectorError.ssl   s    ~~!!!r/   c                     dj                  | | j                  du rd| j                        S | j                  | j                        S )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]TdefaultrF   rs   rh   rI   s    r0   rJ   zClientConnectorError.__str__   sB    GNNtxx4/)t}}
 	
59XXt}}
 	
r/   )r*   r+   r,   r-   r   OSErrorrD   rV   ra   rG   rm   r   rU   rq   r   
SSLContextboolrs   rJ   BaseException
__reduce____classcell__ri   s   @r0   r   r      s    /} / /D / '   #c # # #hsm # # "U:t]:; " "
 
 ))Jr/   r   c                       e Zd ZdZy)r   zProxy connection error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        connection to proxy can not be established.
    Nr)   r.   r/   r0   r   r      s    r/   r   c                   V     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.
    pathr`   ra   r9   Nc                 4    || _         t        | 	  ||       y rc   )_pathrf   rD   )rC   r   r`   ra   ri   s       r0   rD   z!UnixClientConnectorError.__init__   s     
2r/   c                     | j                   S rc   )r   rI   s    r0   r   zUnixClientConnectorError.path   s    zzr/   c                     dj                  | | j                  du rd| j                        S | j                  | j                        S )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Tru   rv   rI   s    r0   rJ   z UnixClientConnectorError.__str__   sB    ELLtxx4/)t}}
 	
59XXt}}
 	
r/   )r*   r+   r,   r-   rG   r   rw   rD   rV   r   rJ   r|   r}   s   @r0   r   r      sT    33)63BI3	3 c  
 
r/   r   c                       e Zd ZdZy)r   zServer connection errors.Nr)   r.   r/   r0   r   r          #r/   r   c                   .    e Zd ZdZddeeedf   ddfdZy)r   zServer disconnected.Nr5   r9   c                 *    |d}|f| _         || _        y )NzServer disconnected)rB   r5   )rC   r5   s     r0   rD   z ServerDisconnectedError.__init__   s    ?+GJ	r/   rc   )r*   r+   r,   r-   r   r   rG   rD   r.   r/   r0   r   r      s&    &8#t&C D PT r/   r   c                       e Zd ZdZy)r   zServer timeout error.Nr)   r.   r/   r0   r   r          r/   r   c                       e Zd ZdZy)r   zConnection timeout error.Nr)   r.   r/   r0   r   r      r   r/   r   c                       e Zd ZdZy)r   zSocket timeout error.Nr)   r.   r/   r0   r   r      r   r/   r   c            
       8    e Zd ZdZdededededdf
dZdefd	Zy)
r   z4SSL certificate does not match expected fingerprint.expectedgotrm   rq   r9   Nc                 R    || _         || _        || _        || _        ||||f| _        y rc   )r   r   rm   rq   rB   )rC   r   r   rm   rq   s        r0   rD   z"ServerFingerprintMismatch.__init__  s.     		sD$/	r/   c                     dj                  | j                  j                  | j                  | j                  | j
                  | j                        S )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)rF   ri   r*   r   r   rm   rq   rI   s    r0   rO   z"ServerFingerprintMismatch.__repr__  s:    @GGNN##T]]DHHdii
 	
r/   )	r*   r+   r,   r-   bytesrG   rU   rD   rO   r.   r/   r0   r   r     s9    >0 0U 0# 0S 0T 0
# 
r/   r   c                       e Zd ZdZy)r!   zResponse payload error.Nr)   r.   r/   r0   r!   r!     s    !r/   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descriptionr9   c                 f    || _         || _        |rt        |   ||       y t        |   |       y rc   )_url_descriptionrf   rD   )rC   r   r   ri   s      r0   rD   zInvalidURL.__init__!  s3     	'GS+.GS!r/   c                     | j                   S rc   )r   rI   s    r0   r   zInvalidURL.url,  s    yyr/   c                     | j                   S rc   )r   rI   s    r0   r   zInvalidURL.description0  s       r/   c                 <    d| j                   j                   d|  dS )N< >)ri   r*   rI   s    r0   rO   zInvalidURL.__repr__4  s"    4>>**+1TF!44r/   c                 z    | j                   r| j                   d| j                    S t        | j                        S )Nz - )r   r   rG   rI   s    r0   rJ   zInvalidURL.__str__7  s5    ii[D$5$5#677499~r/   rc   )r9   z
str | None)r*   r+   r,   r-   r
   r   rG   rD   rV   r   r   rO   rJ   r|   r}   s   @r0   r"   r"     sr    	"H 	"5d3C 	"t 	" X   ! !5# 5 r/   r"   c                       e Zd ZdZy)r#   zInvalid URL client error.Nr)   r.   r/   r0   r#   r#   =  r   r/   r#   c                       e Zd ZdZy)r$   zClient redirect error.Nr)   r.   r/   r0   r$   r$   A  s     r/   r$   c                       e Zd ZdZy)r%   zNon http URL client error.Nr)   r.   r/   r0   r%   r%   E  s    $r/   r%   c                       e Zd ZdZy)r&   z"Invalid URL redirect client error.Nr)   r.   r/   r0   r&   r&   I  s    ,r/   r&   c                       e Zd ZdZy)r'   z#Non http URL redirect client error.Nr)   r.   r/   r0   r'   r'   M  s    -r/   r'   c                       e Zd ZdZy)r   zBase error for ssl.*Errors.Nr)   r.   r/   r0   r   r   Q  s    %r/   r   c                       e Zd ZdZy)r   zResponse ssl error.Nr)   r.   r/   r0   r   r   i  s    r/   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y)r   zResponse certificate error.r`   certificate_errorr9   Nc                 2    || _         || _        ||f| _        y rc   )rd   _certificate_errorrB   )rC   r`   r   s      r0   rD   z(ClientConnectorCertificateError.__init__p  s      ("3#%67	r/   c                     | j                   S rc   )r   rI   s    r0   r   z1ClientConnectorCertificateError.certificate_errorw  s    &&&r/   c                 .    | j                   j                  S rc   rl   rI   s    r0   rm   z$ClientConnectorCertificateError.host{  rn   r/   c                 .    | j                   j                  S rc   rp   rI   s    r0   rq   z$ClientConnectorCertificateError.port  rn   r/   c                 .    | j                   j                  S rc   )rd   is_sslrI   s    r0   rs   z#ClientConnectorCertificateError.ssl  s    ~~$$$r/   c                 $    dj                  |       S )Nz{Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} [{0.certificate_error.__class__.__name__}: {0.certificate_error.args}])rF   rI   s    r0   rJ   z'ClientConnectorCertificateError.__str__  s    **0&,	
r/   )r*   r+   r,   r-   r   	ExceptionrD   rV   r   rG   rm   r   rU   rq   ry   rs   rJ   r.   r/   r0   r   r   m  s    %8+8@I8	8 '9 ' ' #c # # #hsm # # %T % %
 
r/   r   )<r-   asyncior?   typingr   r   r   r   http_parserr   typedefsr	   r
   rs   rx   ImportErrorclient_reqrepr   r   r   r   __all__r   r   r   r    r   r   r\   r   rw   r   r   r   r   r   r   TimeoutErrorr   r   r   r   r!   r>   r"   r#   r$   r%   r&   r'   r   CertificateErrorcert_errorscert_errors_basesSSLError
ssl_errorsssl_error_basestupler   r   r.   r/   r0   <module>r      s>      8 8 + ,J
 VV377K7.=:3) 3L+ L^** *,0 ,. 0* 0/K /)7 #*= #*L!5 
3 
.$1 $3  .0D0D  $/ $ +  
 5 
 " ""j "J$J $!+ !%K %-$9;N -.$9;N .&) & ?'')K
 ,,J%s||4O'K
 J%'O 
'8 

  C*s   G 	G! G!