o
    RÊÆhå$  ã                   @   sD  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y:   d ZZY nw erJd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                   @   ó   e Zd ZdZdS )r   z(Base class for client connection errors.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r&   r&   úf/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/aiohttp/client_exceptions.pyr   -   ó    r   c                   @   sœ   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d„Zde	fdd„Zde	fdd„Zedefdd„ƒZejdeddf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Úhistory.r*   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r'|| _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__;   s(   
ÿýzClientResponseError.__init__c                 C   s   d  | j| j| jj¡S )Nz{}, message={!r}, url={!r})Úformatr+   r,   r.   Úreal_url©r9   r&   r&   r'   Ú__str__\   s
   ýzClientResponseError.__str__c                 C   sv   | j ›d| j›�}| jdkr|d| j›�7 }| jdkr#|d| j›�7 }| jd ur0|d| j›�7 }t| ƒj› d|› d�S )	Nz, r   z	, status=r)   z
, message=z
, headers=ú(ú))r.   r/   r+   r,   r-   Útyper"   )r9   r8   r&   r&   r'   Ú__repr__c   s   


zClientResponseError.__repr__c                 C   s   t jdtdd� | jS ©Nz/code property is deprecated, use status insteadr1   r2   ©r5   r6   r7   r+   r=   r&   r&   r'   r*   m   s   ýzClientResponseError.codeÚvaluec                 C   s   t jdtdd� || _d S rC   rD   )r9   rE   r&   r&   r'   r*   v   s   ý
)r"   r#   r$   r%   r   r   r
   r   ÚintÚstrr	   r:   r>   rB   Úpropertyr*   Úsetterr&   r&   r&   r'   r   1   s6    øþ
ýûúùø	
÷!
r   c                   @   r    )r   zContentType found is not valid.Nr!   r&   r&   r&   r'   r   €   r(   r   c                   @   r    )r   z!websocket server handshake error.Nr!   r&   r&   r&   r'   r   „   r(   r   c                   @   r    )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   ˆ   r(   r   c                   @   r    )ÚTooManyRedirectsz%Client was redirected too many times.Nr!   r&   r&   r&   r'   rJ   ‘   r(   rJ   c                   @   r    )r   z$Base class for client socket errors.Nr!   r&   r&   r&   r'   r   •   r(   r   c                   @   r    )r   zOSError error.Nr!   r&   r&   r&   r'   r   ™   r(   r   c                       sš   e Zd ZdZdededdf‡ fdd„Zedefdd	„ƒZede	fd
d„ƒZ
edee fdd„ƒZedeededf fdd„ƒZde	f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.
    Úconnection_keyÚos_errorr0   Nc                    s,   || _ || _tƒ  |j|j¡ ||f| _d S ©N)Ú	_conn_keyÚ	_os_errorÚsuperr:   ÚerrnoÚstrerrorr8   )r9   rK   rL   ©Ú	__class__r&   r'   r:   ¤   s   zClientConnectorError.__init__c                 C   ó   | j S rM   )rO   r=   r&   r&   r'   rL   ª   ó   zClientConnectorError.os_errorc                 C   ó   | j jS rM   ©rN   Úhostr=   r&   r&   r'   rY   ®   ó   zClientConnectorError.hostc                 C   rW   rM   ©rN   Úportr=   r&   r&   r'   r\   ²   rZ   zClientConnectorError.portr   c                 C   rW   rM   )rN   Ússlr=   r&   r&   r'   r]   ¶   rZ   zClientConnectorError.sslc                 C   ó&   d  | | jd ur| j| j¡S d| j¡S )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]Údefault©r;   r]   rR   r=   r&   r&   r'   r>   º   ó
   ÿÿzClientConnectorError.__str__)r"   r#   r$   r%   r   ÚOSErrorr:   rH   rL   rG   rY   r   rF   r\   r   Ú
SSLContextÚboolr]   r>   ÚBaseExceptionÚ
__reduce__Ú__classcell__r&   r&   rS   r'   r   �   s    r   c                   @   r    )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   Ã   r(   r   c                       sR   e Zd ZdZdedededdf‡ fdd„Zedefd	d
„ƒZ	def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.
    ÚpathrK   rL   r0   Nc                    s   || _ tƒ  ||¡ d S rM   )Ú_pathrP   r:   )r9   ri   rK   rL   rS   r&   r'   r:   Ò   s   z!UnixClientConnectorError.__init__c                 C   rU   rM   )rj   r=   r&   r&   r'   ri   Ø   rV   zUnixClientConnectorError.pathc                 C   r^   )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]r_   r`   r=   r&   r&   r'   r>   Ü   ra   z UnixClientConnectorError.__str__)r"   r#   r$   r%   rG   r   rb   r:   rH   ri   r>   rg   r&   r&   rS   r'   rh   Ë   s    ÿÿÿþrh   c                   @   r    )r   zServer connection errors.Nr!   r&   r&   r&   r'   r   â   r(   r   c                   @   s.   e Zd ZdZddeeedf ddfdd„ZdS )r   zServer disconnected.Nr,   r0   c                 C   s   |d u rd}|f| _ || _d S )NzServer disconnected)r8   r,   )r9   r,   r&   r&   r'   r:   é   s   
z ServerDisconnectedError.__init__rM   )r"   r#   r$   r%   r   r   rG   r:   r&   r&   r&   r'   r   æ   s    "r   c                   @   r    )r   zServer timeout error.Nr!   r&   r&   r&   r'   r   ñ   r(   r   c                
   @   s<   e Zd ZdZdededededdf
dd	„Zdefd
d„ZdS )r   z4SSL certificate does not match expected fingerprint.ÚexpectedÚgotrY   r\   r0   Nc                 C   s*   || _ || _|| _|| _||||f| _d S rM   )rk   rl   rY   r\   r8   )r9   rk   rl   rY   r\   r&   r&   r'   r:   ø   s
   z"ServerFingerprintMismatch.__init__c                 C   s   d  | jj| j| j| j| j¡S )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)r;   rT   r"   rk   rl   rY   r\   r=   r&   r&   r'   rB   ÿ   s   ÿz"ServerFingerprintMismatch.__repr__)	r"   r#   r$   r%   ÚbytesrG   rF   r:   rB   r&   r&   r&   r'   r   õ   s    r   c                   @   r    )r   zResponse payload error.Nr!   r&   r&   r&   r'   r     r(   r   c                       sJ   e Zd ZdZdeddf‡ fdd„Zedefdd„ƒZdefd	d
„Z	‡  Z
S )r   zbInvalid URL.

    URL used for fetching is malformed, e.g. it doesn't contains host
    part.
    Úurlr0   Nc                    s   t ƒ  |¡ d S rM   )rP   r:   )r9   rn   rS   r&   r'   r:     s   zInvalidURL.__init__c                 C   s
   | j d S )Nr   )r8   r=   r&   r&   r'   rn     s   
zInvalidURL.urlc                 C   s   d| j j› d| j› d�S )Nú<ú ú>)rT   r"   rn   r=   r&   r&   r'   rB     s   zInvalidURL.__repr__)r"   r#   r$   r%   r   r:   rH   rn   rG   rB   rg   r&   r&   rS   r'   r   	  s    r   c                   @   r    )r   zBase error for ssl.*Errors.Nr!   r&   r&   r&   r'   r     r(   r   c                   @   r    )r   zResponse ssl error.Nr!   r&   r&   r&   r'   r   7  r(   r   c                   @   s€   e Zd ZdZdededdfdd„Zedefdd	„ƒZede	fd
d„ƒZ
edee fdd„ƒZedefdd„ƒZde	fdd„ZdS )r   zResponse certificate error.rK   Úcertificate_errorr0   Nc                 C   s   || _ || _||f| _d S rM   )rN   Ú_certificate_errorr8   )r9   rK   rr   r&   r&   r'   r:   >  s   z(ClientConnectorCertificateError.__init__c                 C   rU   rM   )rs   r=   r&   r&   r'   rr   E  rV   z1ClientConnectorCertificateError.certificate_errorc                 C   rW   rM   rX   r=   r&   r&   r'   rY   I  rZ   z$ClientConnectorCertificateError.hostc                 C   rW   rM   r[   r=   r&   r&   r'   r\   M  rZ   z$ClientConnectorCertificateError.portc                 C   rW   rM   )rN   Úis_sslr=   r&   r&   r'   r]   Q  rZ   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>   U  s   ýz'ClientConnectorCertificateError.__str__)r"   r#   r$   r%   r   Ú	Exceptionr:   rH   rr   rG   rY   r   rF   r\   rd   r]   r>   r&   r&   r&   r'   r   ;  s$    ÿÿ
þr   )5r%   Úasyncior5   Útypingr   r   r   r   r   Úhttp_parserr   Útypedefsr	   r]   rc   ÚImportErrorÚclient_reqrepr
   r   r   r   Ú__all__ru   r   r   r   r   r   rJ   r   rb   r   r   r   rh   r   r   ÚTimeoutErrorr   r   r   r4   r   r   ÚCertificateErrorÚcert_errorsÚcert_errors_basesÚSSLErrorÚ
ssl_errorsÚssl_error_basesÚtupler   r   r&   r&   r&   r'   Ú<module>   sb    
ÿO	&þþ