
    gg,                     >   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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jR                        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7ejn                  fZ8e6ejn                  fZ9ejt                  fZ;e6ejt                  fZ<n e=       Z8e6e/fZ9 e=       Z;e6fZ< G d@ dAge< Z> G dB dCge9 Z? G dD dEe@      ZAy# e$ r dxZZY w xY w)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y)r   z(Base class for client connection errors.N__name__
__module____qualname____doc__     N/var/www/openai/venv/lib/python3.12/site-packages/aiohttp/client_exceptions.pyr   r   =   s    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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.r6   r7   r8   r9   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   )
r:   
ValueErrorwarningswarnDeprecationWarningr7   r8   r9   r;   args)selfr:   r;   r6   r7   r8   r9   s          r3   __init__zClientResponseError.__init__K   s     )! =  MMA"
  DKDKDK!7+	r2   c                     dj                  | j                  | j                  t        | j                  j
                              S )Nz{}, message={!r}, url={!r})formatr7   r8   strr:   real_urlrF   s    r3   __str__zClientResponseError.__str__l   s7    +22KKLL!!**+
 	
r2   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=r5   z
, message=z
, headers=())r:   r;   r7   r8   r9   typer-   )rF   rE   s     r3   __repr__zClientResponseError.__repr__s   s    ##&b(89;;!i//D<<2j 011D<<#j 011Dt*%%&avQ//r2   c                 R    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                 J    t        j                  dt        d       || _        y rT   rU   )rF   rV   s     r3   r6   zClientResponseError.code   s     =	

 r2   )r-   r.   r/   r0   r   r   r
   r   intrJ   r   rG   rM   rR   propertyr6   setterr1   r2   r3   r   r   A   s     # $/3,!, ~s*+,
 sm, , , ,s+,, 
,B
 
0# 0 c   
[[# $  r2   r   c                       e Zd ZdZy)r"   zContentType found is not valid.Nr,   r1   r2   r3   r"   r"      s    )r2   r"   c                       e Zd ZdZy)r!   z!websocket server handshake error.Nr,   r1   r2   r3   r!   r!      s    +r2   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,   r1   r2   r3   r    r       s    r2   r    c                       e Zd ZdZy)TooManyRedirectsz%Client was redirected too many times.Nr,   r1   r2   r3   r_   r_      s    /r2   r_   c                       e Zd ZdZy)r   z$Base class for client socket errors.Nr,   r1   r2   r3   r   r          .r2   r   c                       e Zd ZdZy)r   ConnectionResetErrorNr,   r1   r2   r3   r   r      s    r2   r   c                       e Zd ZdZy)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| _        y N)	_conn_key	_os_errorsuperrG   errnostrerrorrE   )rF   rf   rg   	__class__s      r3   rG   zClientConnectorError.__init__   s6    '!):):;#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                     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rI   ry   rn   rL   s    r3   rM   zClientConnectorError.__str__   sB    GNNtxx4/)t}}
 	
59XXt}}
 	
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 / '   #c # # #hsm # # "U:t]:; " "
 
 ))Jr2   r   c                       e Zd ZdZy)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y)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                   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.
    pathrf   rg   r<   Nc                 4    || _         t        | 	  ||       y ri   )_pathrl   rG   )rF   r   rf   rg   ro   s       r3   rG   z!UnixClientConnectorError.__init__   s     
2r2   c                     | j                   S ri   )r   rL   s    r3   r   zUnixClientConnectorError.path   s    zzr2   c                     dj                  | | j                  du rd| j                        S | j                  | j                        S )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Tr{   r|   rL   s    r3   rM   z UnixClientConnectorError.__str__   sB    ELLtxx4/)t}}
 	
59XXt}}
 	
r2   )r-   r.   r/   r0   rJ   r   r}   rG   rY   r   rM   r   r   s   @r3   r   r      sT    33)63BI3	3 c  
 
r2   r   c                       e Zd ZdZy)r   zServer connection errors.Nr,   r1   r2   r3   r   r          #r2   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.Nr8   r<   c                 *    |d}|f| _         || _        y )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     s&    &8#t&C D PT r2   r   c                       e Zd ZdZy)r   zServer timeout error.Nr,   r1   r2   r3   r   r         r2   r   c                       e Zd ZdZy)r   zConnection timeout error.Nr,   r1   r2   r3   r   r     r   r2   r   c                       e Zd ZdZy)r   zSocket timeout error.Nr,   r1   r2   r3   r   r     r   r2   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gotrs   rw   r<   Nc                 R    || _         || _        || _        || _        ||||f| _        y ri   )r   r   rs   rw   rE   )rF   r   r   rs   rw   s        r3   rG   z"ServerFingerprintMismatch.__init__  s.     		sD$/	r2   c                     dj                  | 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__#  s:    @GGNN##T]]DHHdii
 	
r2   )	r-   r.   r/   r0   bytesrJ   rX   rG   rR   r1   r2   r3   r   r     s9    >0 0U 0# 0S 0T 0
# 
r2   r   c                       e Zd ZdZy)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                 f    || _         || _        |rt        |   ||       y t        |   |       y ri   )_url_descriptionrl   rG   )rF   r   r   ro   s      r3   rG   zInvalidURL.__init__6  s3     	'GS+.GS!r2   c                     | j                   S ri   )r   rL   s    r3   r   zInvalidURL.urlA  s    yyr2   c                     | 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"    4>>**+1TF!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  s5    ii[D$5$5#677499~r2   ri   )r<   z
str | None)r-   r.   r/   r0   r	   r   rJ   rG   rY   r   r   rR   rM   r   r   s   @r3   r$   r$   -  sr    	"H 	"5d3C 	"t 	" X   ! !5# 5 r2   r$   c                       e Zd ZdZy)r%   zInvalid URL client error.Nr,   r1   r2   r3   r%   r%   R  r   r2   r%   c                       e Zd ZdZy)r&   zClient redirect error.Nr,   r1   r2   r3   r&   r&   V  s     r2   r&   c                       e Zd ZdZy)r'   zNon http URL client error.Nr,   r1   r2   r3   r'   r'   Z  s    $r2   r'   c                       e Zd ZdZy)r(   z"Invalid URL redirect client error.Nr,   r1   r2   r3   r(   r(   ^  s    ,r2   r(   c                       e Zd ZdZy)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y)r   zBase error for ssl.*Errors.Nr,   r1   r2   r3   r   r   f  s    %r2   r   c                       e Zd ZdZy)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y)r   zResponse certificate error.rf   certificate_errorr<   Nc                 2    || _         || _        ||f| _        y 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j                  |       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 '9 ' ' #c # # #hsm # # %T % %
 
r2   r   c                       e Zd ZdZy)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 " J ^^
 VV/HLLKL.L=3E@3) 3L+ L^** *,0 ,. 0* 0/K /!68L )7 #*= #*L2 !5 
3 
.$1 $3  .0D0D  $/ $ +  
 5 
 " ""j "J$J $!+ !%K %-$9;N -.$9;N .&) & ?'')K
 ,,J%s||4O'K
 J%'O 
'8 
D/ /a   j s   H 	HH