a
    8öjà-  ã                   @   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r°d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�r²e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/   úX/mnt/bigstor/www/usecases/.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   z¡HTTP 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   zƒClient 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   zŒDNS 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   zŠProxy 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 )ÚUnixClientConnectorErrorzŽUnix 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U dZeed< 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dœdd„ƒZe
dœdd„Z‡  ZS )r   zResponse certificate error.rW   N)rT   Úcertificate_errorr8   c                    s>   t |ttf ƒr|}ntƒ }tƒ  ||¡ || _||f| _d S rV   )Ú
isinstanceÚcert_errorsre   rY   rB   Ú_certificate_errorr@   )rA   rT   rx   rU   r\   r/   r0   rB   ‡  s    z(ClientConnectorCertificateError.__init__rC   c                 C   s   | j S rV   )r{   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
   Ú__annotations__Ú	ExceptionrB   rP   rx   rE   r_   r   rO   ra   rg   rb   rG   rj   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.   Zasyncior=   Útypingr   r   r   r   Z	multidictr   Ztypedefsr   rb   rf   ÚImportErrorZclient_reqrepr	   r
   r   r   Zhttp_parserr   Ú__all__r}   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   ÚCertificateErrorrz   Zcert_errors_basesÚSSLErrorZ
ssl_errorsZssl_error_basesÚtupler   r   Ú	TypeErrorr)   r/   r/   r/   r0   Ú<module>   sz   
 O	&%
þþ-