a
     ÑOc6$  ã                   @   sF  d Z ddlZddlZddlmZmZmZmZmZ ddl	m
Z
 ddlmZ zddlZejZW n eyt   d ZZY n0 er”ddlmZmZmZmZ nd 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ƒ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e)ƒZ*G d+d,„ d,e ƒZ+edu�rüej,fZ-e+ej,fZ.ej/fZ0e+ej/fZ1ne2ƒ Z-e+e)fZ.e2ƒ Z0e+fZ1G d-d.„ d.ge1¢R Ž Z3G d/d0„ d0ge.¢R Ž Z4dS )1zHTTP related errors.é    N)ÚTYPE_CHECKINGÚAnyÚOptionalÚTupleÚUnioné   )ÚRawResponseMessage)ÚLooseHeaders)ÚClientResponseÚConnectionKeyÚFingerprintÚRequestInfo)ÚClientErrorÚClientConnectionErrorÚClientOSErrorÚClientConnectorErrorÚClientProxyConnectionErrorÚClientSSLErrorÚClientConnectorSSLErrorÚClientConnectorCertificateErrorÚServerConnectionErrorÚServerTimeoutErrorÚServerDisconnectedErrorÚServerFingerprintMismatchÚClientResponseErrorÚClientHttpProxyErrorÚWSServerHandshakeErrorÚContentTypeErrorÚClientPayloadErrorÚ
InvalidURLc                   @   s   e Zd ZdZdS )r   z(Base class for client connection errors.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r%   r%   úP/var/www/html/gsl.tools/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
 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   zYConnection error during reading response.

    request_info: instance of RequestInfo
    NÚ )ÚcodeÚstatusÚmessageÚheaders.)Úrequest_infoÚhistoryr(   r)   r*   r+   Ú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   )
r,   Ú
ValueErrorÚwarningsÚwarnÚDeprecationWarningr)   r*   r+   r-   Úargs)Úselfr,   r-   r(   r)   r*   r+   r%   r%   r&   Ú__init__7   s(    
ÿýzClientResponseError.__init__©r.   c                 C   s   d  | j| j| jj¡S )Nz{}, message={!r}, url={!r})Úformatr)   r*   r,   Zreal_url©r7   r%   r%   r&   Ú__str__X   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=r'   z
, message=z
, headers=ú(ú))r,   r-   r)   r*   r+   Útyper!   )r7   r6   r%   r%   r&   Ú__repr___   s    


zClientResponseError.__repr__c                 C   s   t jdtdd� | jS ©Nz/code property is deprecated, use status insteadr/   r0   ©r3   r4   r5   r)   r;   r%   r%   r&   r(   i   s    ýzClientResponseError.code)Úvaluer.   c                 C   s   t jdtdd� || _d S rA   rB   )r7   rC   r%   r%   r&   r(   r   s    ý)r!   r"   r#   r$   r   r   r
   r   ÚintÚstrr	   r8   r<   r@   Úpropertyr(   Úsetterr%   r%   r%   r&   r   1   s(   
ø
÷!
r   c                   @   s   e Zd ZdZdS )r   zContentType found is not valid.Nr    r%   r%   r%   r&   r   |   s   r   c                   @   s   e Zd ZdZdS )r   z!websocket server handshake error.Nr    r%   r%   r%   r&   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%   r&   r   „   s   r   c                   @   s   e Zd ZdZdS )ÚTooManyRedirectsz%Client was redirected too many times.Nr    r%   r%   r%   r&   rH   �   s   rH   c                   @   s   e Zd ZdZdS )r   z$Base class for client socket errors.Nr    r%   r%   r%   r&   r   ‘   s   r   c                   @   s   e Zd ZdZdS )r   zOSError error.Nr    r%   r%   r%   r&   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d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_errorr.   c                    s,   || _ || _tƒ  |j|j¡ ||f| _d S ©N)Ú	_conn_keyÚ	_os_errorÚsuperr8   ÚerrnoÚstrerrorr6   )r7   rI   rJ   ©Ú	__class__r%   r&   r8       s    zClientConnectorError.__init__r9   c                 C   s   | j S rK   )rM   r;   r%   r%   r&   rJ   ¦   s    zClientConnectorError.os_errorc                 C   s   | j jS rK   ©rL   Úhostr;   r%   r%   r&   rT   ª   s    zClientConnectorError.hostc                 C   s   | j jS rK   ©rL   Úportr;   r%   r%   r&   rV   ®   s    zClientConnectorError.portr   c                 C   s   | j jS rK   )rL   Ússlr;   r%   r%   r&   rW   ²   s    zClientConnectorError.sslc                 C   s    d  | | jd ur| jnd| j¡S )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]Údefault©r:   rW   rP   r;   r%   r%   r&   r<   ¶   s    ÿzClientConnectorError.__str__)r!   r"   r#   r$   r   ÚOSErrorr8   rF   rJ   rE   rT   r   rD   rV   r   Ú
SSLContextÚboolrW   r<   ÚBaseExceptionÚ
__reduce__Ú__classcell__r%   r%   rQ   r&   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%   r&   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)ÚpathrI   rJ   r.   c                    s   || _ tƒ  ||¡ d S rK   )Ú_pathrN   r8   )r7   ra   rI   rJ   rQ   r%   r&   r8   Î   s    z!UnixClientConnectorError.__init__r9   c                 C   s   | j S rK   )rb   r;   r%   r%   r&   ra   Ô   s    zUnixClientConnectorError.pathc                 C   s    d  | | jd ur| jnd| j¡S )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]rX   rY   r;   r%   r%   r&   r<   Ø   s    ÿz UnixClientConnectorError.__str__)r!   r"   r#   r$   rE   r   rZ   r8   rF   ra   r<   r_   r%   r%   rQ   r&   r`   Ç   s   þr`   c                   @   s   e Zd ZdZdS )r   zServer connection errors.Nr    r%   r%   r%   r&   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)r*   r.   c                 C   s   |d u rd}|f| _ || _d S )NzServer disconnected)r6   r*   )r7   r*   r%   r%   r&   r8   å   s    z ServerDisconnectedError.__init__)N)r!   r"   r#   r$   r   r   rE   r8   r%   r%   r%   r&   r   â   s   r   c                   @   s   e Zd ZdZdS )r   zServer timeout error.Nr    r%   r%   r%   r&   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ÚgotrT   rV   r.   c                 C   s*   || _ || _|| _|| _||||f| _d S rK   )rc   rd   rT   rV   r6   )r7   rc   rd   rT   rV   r%   r%   r&   r8   ô   s
    z"ServerFingerprintMismatch.__init__r9   c                 C   s   d  | jj| j| j| j| j¡S )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)r:   rR   r!   rc   rd   rT   rV   r;   r%   r%   r&   r@   û   s    ÿz"ServerFingerprintMismatch.__repr__)	r!   r"   r#   r$   ÚbytesrE   rD   r8   r@   r%   r%   r%   r&   r   ñ   s   r   c                   @   s   e Zd ZdZdS )r   zResponse payload error.Nr    r%   r%   r%   r&   r     s   r   c                       sH   e Zd ZdZeddœ‡ fdd„Ze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)Úurlr.   c                    s   t ƒ  |¡ d S rK   )rN   r8   )r7   rf   rQ   r%   r&   r8     s    zInvalidURL.__init__r9   c                 C   s
   | j d S )Nr   )r6   r;   r%   r%   r&   rf     s    zInvalidURL.urlc                 C   s   d| j j› d| j› d�S )Nú<ú ú>)rR   r!   rf   r;   r%   r%   r&   r@     s    zInvalidURL.__repr__)r!   r"   r#   r$   r   r8   rF   rf   rE   r@   r_   r%   r%   rQ   r&   r     s
   r   c                   @   s   e Zd ZdZdS )r   zBase error for ssl.*Errors.Nr    r%   r%   r%   r&   r     s   r   c                   @   s   e Zd ZdZdS )r   zResponse ssl error.Nr    r%   r%   r%   r&   r   3  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)rI   Úcertificate_errorr.   c                 C   s   || _ || _||f| _d S rK   )rL   Ú_certificate_errorr6   )r7   rI   rj   r%   r%   r&   r8   :  s    z(ClientConnectorCertificateError.__init__r9   c                 C   s   | j S rK   )rk   r;   r%   r%   r&   rj   A  s    z1ClientConnectorCertificateError.certificate_errorc                 C   s   | j jS rK   rS   r;   r%   r%   r&   rT   E  s    z$ClientConnectorCertificateError.hostc                 C   s   | j jS rK   rU   r;   r%   r%   r&   rV   I  s    z$ClientConnectorCertificateError.portc                 C   s   | j jS rK   )rL   Zis_sslr;   r%   r%   r&   rW   M  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}])r:   r;   r%   r%   r&   r<   Q  s    þÿz'ClientConnectorCertificateError.__str__)r!   r"   r#   r$   r   Ú	Exceptionr8   rF   rj   rE   rT   r   rD   rV   r\   rW   r<   r%   r%   r%   r&   r   7  s   þr   )5r$   Zasyncior3   Útypingr   r   r   r   r   Zhttp_parserr   Ztypedefsr	   rW   r[   ÚImportErrorZclient_reqrepr
   r   r   r   Ú__all__rl   r   r   r   r   r   rH   r   rZ   r   r   r   r`   r   r   ÚTimeoutErrorr   r   r   r2   r   r   ÚCertificateErrorZcert_errorsZcert_errors_basesÚSSLErrorZ
ssl_errorsZssl_error_basesÚtupler   r   r%   r%   r%   r&   Ú<module>   s^   
K	&
þþ