o
    çûõjÍ-  ã                   @   s  d Z ddlZddlZddlmZmZ ddlmZ ddlm	Z	 er(ddl
Z
e
jZnz	ddl
Z
e
jZW n ey>   d Z
ZY nw erTd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ƒZ-G d4d5„ d5ee.ƒZ/G d6d7„ d7e/ƒZ0G d8d9„ d9eƒZ1G d:d;„ d;eƒZ2G d<d=„ d=e0e1ƒZ3G d>d?„ d?e2e1ƒZ4G d@dA„ dAe!ƒZ5e
du�r]e
j6fZ7e5e
j6fZ8e
j9fZ:e5e
j9fZ;ne<ƒ Z7e5e.fZ8e<ƒ Z:e5fZ;G dBdC„ dCge;¢R Ž Z=G dDdE„ dEge8¢R Ž Z>G dFdG„ dGe?ƒZ@dS )HzHTTP related errors.é    N)ÚTYPE_CHECKINGÚ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ÚUploadAbortedErrorÚ
InvalidURLÚInvalidUrlClientErrorÚRedirectClientErrorÚNonHttpUrlClientErrorÚInvalidUrlRedirectClientErrorÚNonHttpUrlRedirectClientErrorÚWSMessageTypeErrorc                   @   ó   e Zd ZdZdS )r   z(Base class for client connection errors.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r/   r/   úL/opt/steambot/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dB d	edB d
ede	e dB 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.r3   r4   r5   r6   Ú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   )
r7   Ú
ValueErrorÚwarningsÚwarnÚDeprecationWarningr4   r5   r6   r8   Úargs)Úselfr7   r8   r3   r4   r5   r6   r/   r/   r0   Ú__init__L   s(   
ÿýzClientResponseError.__init__c                 C   s    | j › d| j›dt| jjƒ›�S )Nú
, message=z, url=)r4   r5   Ústrr7   Úreal_url©rB   r/   r/   r0   Ú__str__m   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=r2   rD   z
, headers=ú(ú))r7   r8   r4   r5   r6   Útyper+   )rB   rA   r/   r/   r0   Ú__repr__p   s   


zClientResponseError.__repr__c                 C   s   t jdtdd� | jS ©Nz/code property is deprecated, use status insteadr:   r;   ©r>   r?   r@   r4   rG   r/   r/   r0   r3   z   s   ýzClientResponseError.codeÚvaluec                 C   s   t jdtdd� || _d S rM   rN   )rB   rO   r/   r/   r0   r3   ƒ   s   ý
)r+   r,   r-   r.   r
   Útupler   ÚintrE   r   rC   rH   rL   Úpropertyr3   Úsetterr/   r/   r/   r0   r   B   s6    øþ
ýûúù
ø	
÷!
r   c                   @   r)   )r   zContentType found is not valid.Nr*   r/   r/   r/   r0   r   �   r1   r   c                   @   r)   )r   z!websocket server handshake error.Nr*   r/   r/   r/   r0   r   ‘   r1   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/   r0   r   •   r1   r   c                   @   r)   )ÚTooManyRedirectsz%Client was redirected too many times.Nr*   r/   r/   r/   r0   rT   ž   r1   rT   c                   @   r)   )r   z$Base class for client socket errors.Nr*   r/   r/   r/   r0   r   ¢   r1   r   c                   @   r)   )r   ÚConnectionResetErrorNr*   r/   r/   r/   r0   r   ¦   r1   r   c                   @   r)   )r   zOSError error.Nr*   r/   r/   r/   r0   r   ª   r1   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dB fdd„ƒZedee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_errorr9   Nc                    s,   || _ || _tƒ  |j|j¡ ||f| _d S ©N)Ú	_conn_keyÚ	_os_errorÚsuperrC   ÚerrnoÚstrerrorrA   )rB   rV   rW   ©Ú	__class__r/   r0   rC   µ   s   zClientConnectorError.__init__c                 C   ó   | j S rX   )rZ   rG   r/   r/   r0   rW   »   ó   zClientConnectorError.os_errorc                 C   ó   | j jS rX   ©rY   ÚhostrG   r/   r/   r0   rd   ¿   ó   zClientConnectorError.hostc                 C   rb   rX   ©rY   ÚportrG   r/   r/   r0   rg   Ã   re   zClientConnectorError.portr	   c                 C   rb   rX   )rY   ÚsslrG   r/   r/   r0   rh   Ç   re   zClientConnectorError.sslc                 C   ó&   d  | | jdu rd| j¡S | j| j¡S )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]TÚdefault©Úformatrh   r]   rG   r/   r/   r0   rH   Ë   ó
   ÿÿzClientConnectorError.__str__)r+   r,   r-   r.   r   ÚOSErrorrC   rR   rW   rE   rd   rQ   rg   r   Ú
SSLContextÚboolrh   rH   ÚBaseExceptionÚ
__reduce__Ú__classcell__r/   r/   r^   r0   r   ®   s    r   c                   @   r)   )r   zŒDNS resolution failed during client connection.

    Raised in :class:`aiohttp.connector.TCPConnector` if
        DNS resolution fails.
    Nr*   r/   r/   r/   r0   r   Ô   r1   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/   r0   r   Ü   r1   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.
    ÚpathrV   rW   r9   Nc                    s   || _ tƒ  ||¡ d S rX   )Ú_pathr[   rC   )rB   ru   rV   rW   r^   r/   r0   rC   ë   s   z!UnixClientConnectorError.__init__c                 C   r`   rX   )rv   rG   r/   r/   r0   ru   ñ   ra   zUnixClientConnectorError.pathc                 C   ri   )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Trj   rk   rG   r/   r/   r0   rH   õ   rm   z UnixClientConnectorError.__str__)r+   r,   r-   r.   rE   r   rn   rC   rR   ru   rH   rs   r/   r/   r^   r0   rt   ä   s    ÿÿÿþrt   c                   @   r)   )r   zServer connection errors.Nr*   r/   r/   r/   r0   r   û   r1   r   c                   @   s,   e Zd ZdZddeeB dB ddfdd„ZdS )r   zServer disconnected.Nr5   r9   c                 C   s   |d u rd}|f| _ || _d S )NzServer disconnected)rA   r5   )rB   r5   r/   r/   r0   rC     s   
z ServerDisconnectedError.__init__rX   )r+   r,   r-   r.   r   rE   rC   r/   r/   r/   r0   r   ÿ   s     r   c                   @   r)   )r   zServer timeout error.Nr*   r/   r/   r/   r0   r   
  r1   r   c                   @   r)   )r   zConnection timeout error.Nr*   r/   r/   r/   r0   r     r1   r   c                   @   r)   )r   zSocket timeout error.Nr*   r/   r/   r/   r0   r     r1   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Úgotrd   rg   r9   Nc                 C   s*   || _ || _|| _|| _||||f| _d S rX   )rw   rx   rd   rg   rA   )rB   rw   rx   rd   rg   r/   r/   r0   rC     s
   z"ServerFingerprintMismatch.__init__c                 C   s0   d| j j› d| j›d| j›d| j›d| j›d�S )Nú<z
 expected=z got=z host=z port=ú>)r_   r+   rw   rx   rd   rg   rG   r/   r/   r0   rL      s   0z"ServerFingerprintMismatch.__repr__)	r+   r,   r-   r.   ÚbytesrE   rQ   rC   rL   r/   r/   r/   r0   r     s    r   c                   @   r)   )r    zResponse payload error.Nr*   r/   r/   r/   r0   r    $  r1   r    c                   @   r)   )r!   z&The request body was never fully sent.Nr*   r/   r/   r/   r0   r!   (  r1   r!   c                       sp   e Zd ZdZddededB ddf‡ fdd„Zedefdd	„ƒZeddd„ƒZ	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.
    NÚurlÚdescriptionr9   c                    s2   || _ || _|rtƒ  ||¡ d S tƒ  |¡ d S rX   )Ú_urlÚ_descriptionr[   rC   )rB   r|   r}   r^   r/   r0   rC   5  s
   zInvalidURL.__init__c                 C   r`   rX   )r~   rG   r/   r/   r0   r|   @  ra   zInvalidURL.urlú
str | Nonec                 C   r`   rX   )r   rG   r/   r/   r0   r}   D  ra   zInvalidURL.descriptionc                 C   s   d| j j› d| › d�S )Nry   ú rz   )r_   r+   rG   r/   r/   r0   rL   H  s   zInvalidURL.__repr__c                 C   s"   | j r| j› d| j › �S t| jƒS )Nz - )r   r~   rE   rG   r/   r/   r0   rH   K  s   
zInvalidURL.__str__rX   )r9   r€   )r+   r,   r-   r.   r   rE   rC   rR   r|   r}   rL   rH   rs   r/   r/   r^   r0   r"   ,  s     r"   c                   @   r)   )r#   zInvalid URL client error.Nr*   r/   r/   r/   r0   r#   Q  r1   r#   c                   @   r)   )r$   zClient redirect error.Nr*   r/   r/   r/   r0   r$   U  r1   r$   c                   @   r)   )r%   zNon http URL client error.Nr*   r/   r/   r/   r0   r%   Y  r1   r%   c                   @   r)   )r&   z"Invalid URL redirect client error.Nr*   r/   r/   r/   r0   r&   ]  r1   r&   c                   @   r)   )r'   z#Non http URL redirect client error.Nr*   r/   r/   r/   r0   r'   a  r1   r'   c                   @   r)   )r   zBase error for ssl.*Errors.Nr*   r/   r/   r/   r0   r   e  r1   r   c                   @   r)   )r   zResponse ssl error.Nr*   r/   r/   r/   r0   r   }  r1   r   c                       s’   e Zd ZU dZeed< 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dB fdd„ƒZedefdd„ƒZde
fdd„Z‡  ZS )r   zResponse certificate error.rY   rV   Úcertificate_errorr9   Nc                    s>   t |ttf ƒr|}ntƒ }tƒ  ||¡ || _||f| _d S rX   )Ú
isinstanceÚcert_errorsrn   r[   rC   Ú_certificate_errorrA   )rB   rV   r‚   rW   r^   r/   r0   rC   †  s   z(ClientConnectorCertificateError.__init__c                 C   r`   rX   )r…   rG   r/   r/   r0   r‚   –  ra   z1ClientConnectorCertificateError.certificate_errorc                 C   rb   rX   rc   rG   r/   r/   r0   rd   š  re   z$ClientConnectorCertificateError.hostc                 C   rb   rX   rf   rG   r/   r/   r0   rg   ž  re   z$ClientConnectorCertificateError.portc                 C   rb   rX   )rY   Úis_sslrG   r/   r/   r0   rh   ¢  re   z#ClientConnectorCertificateError.sslc                 C   s4   d| j › d| j› d| j› d| jjj› d| jj› d�S )NzCannot connect to host ú:z ssl:z [z: ú])rd   rg   rh   r‚   r_   r+   rA   rG   r/   r/   r0   rH   ¦  s   ÿþÿz'ClientConnectorCertificateError.__str__)r+   r,   r-   r.   r   Ú__annotations__Ú	ExceptionrC   rR   r‚   rE   rd   rQ   rg   rp   rh   rH   rs   r/   r/   r^   r0   r   �  s&   
 ýüûr   c                   @   r)   )r(   z$WebSocket message type is not valid.Nr*   r/   r/   r/   r0   r(   ®  r1   r(   )Ar.   Úasyncior>   Útypingr   r   Ú	multidictr   Útypedefsr   rh   ro   ÚImportErrorÚclient_reqrepr   r   r	   r
   Úhttp_parserr   Ú__all__rŠ   r   r   r   r   r   rT   r   rU   r   rn   r   r   r   r   rt   r   r   ÚTimeoutErrorr   r   r   r   r    r!   r=   r"   r#   r$   r%   r&   r'   r   ÚCertificateErrorr„   Úcert_errors_basesÚSSLErrorÚ
ssl_errorsÚssl_error_basesrP   r   r   Ú	TypeErrorr(   r/   r/   r/   r0   Ú<module>   s€    
ÿ!K	&%
þþ-