U
    ;g+                     @   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 zddlZejZW n ek
rr   d ZZY nX 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k	rej7fZ8e6ej7fZ9ej:fZ;e6ej:fZ<ne= Z8e6e/fZ9e= Z;e6fZ<G d@dA dAfe< Z>G dBdC dCfe9 Z?dS )Dz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NonHttpUrlRedirectClientErrorc                   @   s   e Zd ZdZdS )r   z(Base class for client connection errors.N__name__
__module____qualname____doc__ r.   r.   Y/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/aiohttp/client_exceptions.pyr   8   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historyr1   r2   r3   r4   returnc                C   st   || _ |d k	r.|d k	rtdtjdtdd |d k	r>|| _n|d k	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   )
r5   
ValueErrorwarningswarnDeprecationWarningr2   r3   r4   r6   args)selfr5   r6   r1   r2   r3   r4   r.   r.   r/   __init__F   s(    
zClientResponseError.__init__r7   c                 C   s   d | j| jt| jjS )Nz{}, message={!r}, url={!r})formatr2   r3   strr5   Zreal_urlr@   r.   r.   r/   __str__g   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 k	r`|d| j7 }t| j d| dS )	Nz, r   z	, status=r0   z
, message=z
, headers=())r5   r6   r2   r3   r4   typer*   )r@   r?   r.   r.   r/   __repr__n   s    


zClientResponseError.__repr__c                 C   s   t jdtdd | jS Nz/code property is deprecated, use status insteadr8   r9   r<   r=   r>   r2   rE   r.   r.   r/   r1   x   s    zClientResponseError.code)valuer7   c                 C   s   t jdtdd || _d S rK   rL   )r@   rM   r.   r.   r/   r1      s    )r*   r+   r,   r-   r   r   r	   r   intrD   r   rA   rF   rJ   propertyr1   setterr.   r.   r.   r/   r   <   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   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.   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/   rQ      s   rQ   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   ConnectionResetErrorNr)   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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_errorr7   c                    s,   || _ || _t |j|j ||f| _d S N)	_conn_key	_os_errorsuperrA   errnostrerrorr?   )r@   rS   rT   	__class__r.   r/   rA      s    zClientConnectorError.__init__rB   c                 C   s   | j S rU   )rW   rE   r.   r.   r/   rT      s    zClientConnectorError.os_errorc                 C   s   | j jS rU   rV   hostrE   r.   r.   r/   r^      s    zClientConnectorError.hostc                 C   s   | j jS rU   rV   portrE   r.   r.   r/   r`      s    zClientConnectorError.portr   c                 C   s   | j jS rU   )rV   sslrE   r.   r.   r/   ra      s    zClientConnectorError.sslc                 C   s    d | | jdkrdn| j| jS )Nz6Cannot connect to host {0.host}:{0.port} ssl:{1} [{2}]TdefaultrC   ra   rZ   rE   r.   r.   r/   rF      s
      zClientConnectorError.__str__)r*   r+   r,   r-   r
   OSErrorrA   rO   rT   rD   r^   r   rN   r`   r   
SSLContextboolra   rF   BaseException
__reduce____classcell__r.   r.   r[   r/   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.   r/   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.   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 )UnixClientConnectorErrorzUnix connector error.

    Raised in :py:class:`aiohttp.connector.UnixConnector`
    if connection to unix socket can not be established.
    N)pathrS   rT   r7   c                    s   || _ t || d S rU   )_pathrX   rA   )r@   rk   rS   rT   r[   r.   r/   rA      s    z!UnixClientConnectorError.__init__rB   c                 C   s   | j S rU   )rl   rE   r.   r.   r/   rk      s    zUnixClientConnectorError.pathc                 C   s    d | | jdkrdn| j| jS )Nz4Cannot connect to unix socket {0.path} ssl:{1} [{2}]Trb   rc   rE   r.   r.   r/   rF      s
      z UnixClientConnectorError.__str__)r*   r+   r,   r-   rD   r
   rd   rA   rO   rk   rF   ri   r.   r.   r[   r/   rj      s     rj   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)r3   r7   c                 C   s   |d krd}|f| _ || _d S )NzServer disconnected)r?   r3   )r@   r3   r.   r.   r/   rA      s    z ServerDisconnectedError.__init__)N)r*   r+   r,   r-   r   r   rD   rA   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                   @   s   e Zd ZdZdS )r   zConnection timeout error.Nr)   r.   r.   r.   r/   r     s   r   c                   @   s   e Zd ZdZdS )r   zSocket 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gotr^   r`   r7   c                 C   s*   || _ || _|| _|| _||||f| _d S rU   )rm   rn   r^   r`   r?   )r@   rm   rn   r^   r`   r.   r.   r/   rA     s
    z"ServerFingerprintMismatch.__init__rB   c                 C   s   d | jj| j| j| j| jS )Nz/<{} expected={!r} got={!r} host={!r} port={!r}>)rC   r\   r*   rm   rn   r^   r`   rE   r.   r.   r/   rJ     s        z"ServerFingerprintMismatch.__repr__)	r*   r+   r,   r-   bytesrD   rN   rA   rJ   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                       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descriptionr7   c                    s0   || _ || _|r t || nt | d S rU   )_url_descriptionrX   rA   )r@   rp   rq   r[   r.   r/   rA   1  s
    zInvalidURL.__init__rB   c                 C   s   | j S rU   )rr   rE   r.   r.   r/   rp   <  s    zInvalidURL.urlz
str | Nonec                 C   s   | j S rU   )rs   rE   r.   r.   r/   rq   @  s    zInvalidURL.descriptionc                 C   s   d| j j d|  dS )N< >)r\   r*   rE   r.   r.   r/   rJ   D  s    zInvalidURL.__repr__c                 C   s"   | j r| j d| j  S t| jS )Nz - )rs   rr   rD   rE   r.   r.   r/   rF   G  s    zInvalidURL.__str__)N)r*   r+   r,   r-   r   r   rD   rA   rO   rp   rq   rJ   rF   ri   r.   r.   r[   r/   r#   (  s    r#   c                   @   s   e Zd ZdZdS )r$   zInvalid URL client error.Nr)   r.   r.   r.   r/   r$   M  s   r$   c                   @   s   e Zd ZdZdS )r%   zClient redirect error.Nr)   r.   r.   r.   r/   r%   Q  s   r%   c                   @   s   e Zd ZdZdS )r&   zNon http URL client error.Nr)   r.   r.   r.   r/   r&   U  s   r&   c                   @   s   e Zd ZdZdS )r'   z"Invalid URL redirect client error.Nr)   r.   r.   r.   r/   r'   Y  s   r'   c                   @   s   e Zd ZdZdS )r(   z#Non http URL redirect client error.Nr)   r.   r.   r.   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   a  s   r   c                   @   s   e Zd ZdZdS )r   zResponse ssl error.Nr)   r.   r.   r.   r/   r   y  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)rS   certificate_errorr7   c                 C   s   || _ || _||f| _d S rU   )rV   _certificate_errorr?   )r@   rS   rw   r.   r.   r/   rA     s    z(ClientConnectorCertificateError.__init__rB   c                 C   s   | j S rU   )rx   rE   r.   r.   r/   rw     s    z1ClientConnectorCertificateError.certificate_errorc                 C   s   | j jS rU   r]   rE   r.   r.   r/   r^     s    z$ClientConnectorCertificateError.hostc                 C   s   | j jS rU   r_   rE   r.   r.   r/   r`     s    z$ClientConnectorCertificateError.portc                 C   s   | j jS rU   )rV   Zis_sslrE   r.   r.   r/   ra     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}])rC   rE   r.   r.   r/   rF     s    z'ClientConnectorCertificateError.__str__)r*   r+   r,   r-   r
   	ExceptionrA   rO   rw   rD   r^   r   rN   r`   rf   ra   rF   r.   r.   r.   r/   r   }  s    r   )@r-   Zasyncior<   typingr   r   r   r   Z	multidictr   Ztypedefsr   ra   re   ImportErrorZclient_reqrepr	   r
   r   r   Zhttp_parserr   __all__ry   r   r   r!   r    r   rQ   r   rR   r   rd   r   r   r   r   rj   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   r.   r.   r.   r/   <module>   sr   
O	&%
