a
    `gg,                     @   s  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rXddlZejZn.zddlZejZW n ey   d ZZY n0 erddlmZmZmZmZ ddlmZ nd Z Z ZZd	ZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deeZ G dd dee!Z"G dd de"Z#G dd de#Z$G d d! d!e#Z%G d"d# d#e#Z&G d$d% d%eZ'G d&d' d'e'Z(G d(d) d)e'ej)Z*G d*d+ d+e*Z+G d,d- d-e*Z,G d.d/ d/e'Z-G d0d1 d1eZ.G d2d3 d3ee/Z0G d4d5 d5e0Z1G d6d7 d7eZ2G d8d9 d9eZ3G d:d; d;e1e2Z4G d<d= d=e3e2Z5G d>d? d?e#Z6edurej7fZ8e6ej7fZ9ej:fZ;e6ej:fZ<ne= Z8e6e/fZ9e= Z;e6fZ<G d@dA dAge<R  Z>G dBdC dCge9R  Z?G dDdE 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                   @   s   e Zd ZdZdS )r   z(Base class for client connection errors.N__name__
__module____qualname____doc__ r/   r/   g/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/aiohttp/client_exceptions.pyr   =   s   r   c                	   @   s   e Zd ZdZdddddeeedf ee ee e	ee
e	  ddddZe	d	d
dZe	d	ddZeed	ddZejeddd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historyr2   r3   r4   r5   returnc                C   st   || _ |d ur.|d urtdtjdtdd |d ur>|| _n|d urN|| _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   )
r6   
ValueErrorwarningswarnDeprecationWarningr3   r4   r5   r7   args)selfr6   r7   r2   r3   r4   r5   r/   r/   r0   __init__K   s(    
zClientResponseError.__init__r8   c                 C   s   d | j| jt| jjS )Nz{}, message={!r}, url={!r})formatr3   r4   strr6   Zreal_urlrA   r/   r/   r0   __str__l   s
    
zClientResponseError.__str__c                 C   sv   | j d| j}| jdkr,|d| j7 }| jdkrF|d| j7 }| jd ur`|d| j7 }t| j d| dS )	Nz, r   z	, status=r1   z
, message=z
, headers=())r6   r7   r3   r4   r5   typer+   )rA   r@   r/   r/   r0   __repr__s   s    


zClientResponseError.__repr__c                 C   s   t jdtdd | jS Nz/code property is deprecated, use status insteadr9   r:   r=   r>   r?   r3   rF   r/   r/   r0   r2   }   s    zClientResponseError.code)valuer8   c                 C   s   t jdtdd || _d S rL   rM   )rA   rN   r/   r/   r0   r2      s    )r+   r,   r-   r.   r   r   r	   r   intrE   r   rB   rG   rK   propertyr2   setterr/   r/   r/   r0   r   A   s(   

!
r   c                   @   s   e Zd ZdZdS )r!   zContentType found is not valid.Nr*   r/   r/   r/   r0   r!      s   r!   c                   @   s   e Zd ZdZdS )r    z!websocket server handshake error.Nr*   r/   r/   r/   r0   r       s   r    c                   @   s   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*   r/   r/   r/   r0   r      s   r   c                   @   s   e Zd ZdZdS )TooManyRedirectsz%Client was redirected too many times.Nr*   r/   r/   r/   r0   rR      s   rR   c                   @   s   e Zd ZdZdS )r   z$Base class for client socket errors.Nr*   r/   r/   r/   r0   r      s   r   c                   @   s   e Zd ZdZdS )r   ConnectionResetErrorNr*   r/   r/   r/   r0   r      s   r   c                   @   s   e Zd ZdZdS )r   zOSError error.Nr*   r/   r/   r/   r0   r      s   r   c                       s   e Zd ZdZeedd fddZeedddZee	dd	d
Z
eee dddZeeeedf dddZe	dddZejZ  ZS )r   zClient connector error.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        a connection can not be established.
    N)connection_keyos_errorr8   c                    s,   || _ || _t |j|j ||f| _d S N)	_conn_key	_os_errorsuperrB   errnostrerrorr@   )rA   rT   rU   	__class__r/   r0   rB      s    zClientConnectorError.__init__rC   c                 C   s   | j S rV   )rX   rF   r/   r/   r0   rU      s    zClientConnectorError.os_errorc                 C   s   | j jS rV   rW   hostrF   r/   r/   r0   r_      s    zClientConnectorError.hostc                 C   s   | j jS rV   rW   portrF   r/   r/   r0   ra      s    zClientConnectorError.portr   c                 C   s   | j jS rV   )rW   sslrF   r/   r/   r0   rb      s    zClientConnectorError.sslc                 C   s    d | | jdu rdn| j| jS )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]TdefaultrD   rb   r[   rF   r/   r/   r0   rG      s    zClientConnectorError.__str__)r+   r,   r-   r.   r
   OSErrorrB   rP   rU   rE   r_   r   rO   ra   r   
SSLContextboolrb   rG   BaseException
__reduce____classcell__r/   r/   r\   r0   r      s   r   c                   @   s   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*   r/   r/   r/   r0   r      s   r   c                   @   s   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*   r/   r/   r/   r0   r      s   r   c                       sL   e Zd ZdZeeedd fddZeedddZ	edd	d
Z
  ZS )UnixClientConnectorErrorzUnix connector error.

    Raised in :py:class:`aiohttp.connector.UnixConnector`
    if connection to unix socket can not be established.
    N)pathrT   rU   r8   c                    s   || _ t || d S rV   )_pathrY   rB   )rA   rl   rT   rU   r\   r/   r0   rB      s    z!UnixClientConnectorError.__init__rC   c                 C   s   | j S rV   )rm   rF   r/   r/   r0   rl      s    zUnixClientConnectorError.pathc                 C   s    d | | jdu rdn| j| jS )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Trc   rd   rF   r/   r/   r0   rG      s    z UnixClientConnectorError.__str__)r+   r,   r-   r.   rE   r
   re   rB   rP   rl   rG   rj   r/   r/   r\   r0   rk      s   rk   c                   @   s   e Zd ZdZdS )r   zServer connection errors.Nr*   r/   r/   r/   r0   r      s   r   c                   @   s,   e Zd ZdZdeeedf ddddZdS )r   zServer disconnected.N)r4   r8   c                 C   s   |d u rd}|f| _ || _d S )NzServer disconnected)r@   r4   )rA   r4   r/   r/   r0   rB     s    z ServerDisconnectedError.__init__)N)r+   r,   r-   r.   r   r   rE   rB   r/   r/   r/   r0   r     s   r   c                   @   s   e Zd ZdZdS )r   zServer timeout error.Nr*   r/   r/   r/   r0   r     s   r   c                   @   s   e Zd ZdZdS )r   zConnection timeout error.Nr*   r/   r/   r/   r0   r     s   r   c                   @   s   e Zd ZdZdS )r   zSocket timeout error.Nr*   r/   r/   r/   r0   r     s   r   c                   @   s4   e Zd ZdZeeeeddddZedddZdS )	r   z4SSL certificate does not match expected fingerprint.N)expectedgotr_   ra   r8   c                 C   s*   || _ || _|| _|| _||||f| _d S rV   )rn   ro   r_   ra   r@   )rA   rn   ro   r_   ra   r/   r/   r0   rB     s
    z"ServerFingerprintMismatch.__init__rC   c                 C   s   d | jj| j| j| j| jS )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)rD   r]   r+   rn   ro   r_   ra   rF   r/   r/   r0   rK   #  s    z"ServerFingerprintMismatch.__repr__)	r+   r,   r-   r.   bytesrE   rO   rB   rK   r/   r/   r/   r0   r     s   r   c                   @   s   e Zd ZdZdS )r"   zResponse payload error.Nr*   r/   r/   r/   r0   r"   )  s   r"   c                       st   e Zd ZdZdeeedf dd fddZeedddZ	ed	dd
dZ
edddZedddZ  ZS )r#   zbInvalid URL.

    URL used for fetching is malformed, e.g. it doesn't contains host
    part.
    N)urldescriptionr8   c                    s0   || _ || _|r t || nt | d S rV   )_url_descriptionrY   rB   )rA   rq   rr   r\   r/   r0   rB   6  s
    zInvalidURL.__init__rC   c                 C   s   | j S rV   )rs   rF   r/   r/   r0   rq   A  s    zInvalidURL.urlz
str | Nonec                 C   s   | j S rV   )rt   rF   r/   r/   r0   rr   E  s    zInvalidURL.descriptionc                 C   s   d| j j d|  dS )N< >)r]   r+   rF   r/   r/   r0   rK   I  s    zInvalidURL.__repr__c                 C   s"   | j r| j d| j  S t| jS )Nz - )rt   rs   rE   rF   r/   r/   r0   rG   L  s    zInvalidURL.__str__)N)r+   r,   r-   r.   r   r   rE   rB   rP   rq   rr   rK   rG   rj   r/   r/   r\   r0   r#   -  s    r#   c                   @   s   e Zd ZdZdS )r$   zInvalid URL client error.Nr*   r/   r/   r/   r0   r$   R  s   r$   c                   @   s   e Zd ZdZdS )r%   zClient redirect error.Nr*   r/   r/   r/   r0   r%   V  s   r%   c                   @   s   e Zd ZdZdS )r&   zNon http URL client error.Nr*   r/   r/   r/   r0   r&   Z  s   r&   c                   @   s   e Zd ZdZdS )r'   z"Invalid URL redirect client error.Nr*   r/   r/   r/   r0   r'   ^  s   r'   c                   @   s   e Zd ZdZdS )r(   z#Non http URL redirect client error.Nr*   r/   r/   r/   r0   r(   b  s   r(   c                   @   s   e Zd ZdZdS )r   zBase error for ssl.*Errors.Nr*   r/   r/   r/   r0   r   f  s   r   c                   @   s   e Zd ZdZdS )r   zResponse ssl error.Nr*   r/   r/   r/   r0   r   ~  s   r   c                   @   s|   e Zd ZdZeeddddZeedddZee	dd	d
Z
eee dddZeedddZe	dddZdS )r   zResponse certificate error.N)rT   certificate_errorr8   c                 C   s   || _ || _||f| _d S rV   )rW   _certificate_errorr@   )rA   rT   rx   r/   r/   r0   rB     s    z(ClientConnectorCertificateError.__init__rC   c                 C   s   | j S rV   )ry   rF   r/   r/   r0   rx     s    z1ClientConnectorCertificateError.certificate_errorc                 C   s   | j jS rV   r^   rF   r/   r/   r0   r_     s    z$ClientConnectorCertificateError.hostc                 C   s   | j jS rV   r`   rF   r/   r/   r0   ra     s    z$ClientConnectorCertificateError.portc                 C   s   | j jS rV   )rW   Zis_sslrF   r/   r/   r0   rb     s    z#ClientConnectorCertificateError.sslc                 C   s
   d | S )Nz{Cannot connect to host {0.host}:{0.port} ssl:{0.ssl} [{0.certificate_error.__class__.__name__}: {0.certificate_error.args}])rD   rF   r/   r/   r0   rG     s    z'ClientConnectorCertificateError.__str__)r+   r,   r-   r.   r
   	ExceptionrB   rP   rx   rE   r_   r   rO   ra   rg   rb   rG   r/   r/   r/   r0   r     s   r   c                   @   s   e Zd ZdZdS )r)   z$WebSocket message type is not valid.Nr*   r/   r/   r/   r0   r)     s   r)   )Br.   asyncior=   typingr   r   r   r   Z	multidictr   Ztypedefsr   rb   rf   ImportErrorZclient_reqrepr	   r
   r   r   Zhttp_parserr   __all__rz   r   r   r!   r    r   rR   r   rS   r   re   r   r   r   r   rk   r   r   TimeoutErrorr   r   r   r   r"   r<   r#   r$   r%   r&   r'   r(   r   CertificateErrorZcert_errorsZcert_errors_basesSSLErrorZ
ssl_errorsZssl_error_basestupler   r   	TypeErrorr)   r/   r/   r/   r0   <module>   sz   
 O	&%
"