a
    _ŠÝgO!  ã                   @  s  d Z ddlmZ ddlZddlZejr6ddlmZmZ g 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ƒ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ƒ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/d0„ d0eƒZG d1d2„ d2e
ƒZ G d3d4„ d4e
ƒZ!G d5d6„ d6e"ƒZ#G d7d8„ d8e#ƒZ$G d9d:„ d:e#ƒZ%G d;d<„ d<e#ƒZ&G d=d>„ d>e#ƒZ'ej(dDd?d@dAœdBdC„ƒZ)dS )Eul  
Our exception hierarchy:

* HTTPError
  x RequestError
    + TransportError
      - TimeoutException
        Â· ConnectTimeout
        Â· ReadTimeout
        Â· WriteTimeout
        Â· PoolTimeout
      - NetworkError
        Â· ConnectError
        Â· ReadError
        Â· WriteError
        Â· CloseError
      - ProtocolError
        Â· LocalProtocolError
        Â· RemoteProtocolError
      - ProxyError
      - UnsupportedProtocol
    + DecodingError
    + TooManyRedirects
  x HTTPStatusError
* InvalidURL
* CookieConflict
* StreamError
  x StreamConsumed
  x StreamClosed
  x ResponseNotRead
  x RequestNotRead
é    )ÚannotationsNé   )ÚRequestÚResponse)Ú
CloseErrorÚConnectErrorÚConnectTimeoutÚCookieConflictÚDecodingErrorÚ	HTTPErrorÚHTTPStatusErrorÚ
InvalidURLÚLocalProtocolErrorÚNetworkErrorÚPoolTimeoutÚProtocolErrorÚ
ProxyErrorÚ	ReadErrorÚReadTimeoutÚRemoteProtocolErrorÚRequestErrorÚRequestNotReadÚResponseNotReadÚStreamClosedÚStreamConsumedÚStreamErrorÚTimeoutExceptionÚTooManyRedirectsÚTransportErrorÚUnsupportedProtocolÚ
WriteErrorÚWriteTimeoutc                      sP   e Zd ZdZdddœ‡ fdd„Zeddœd	d
„ƒZejdddœdd
„ƒZ‡  ZS )r   a’  
    Base class for `RequestError` and `HTTPStatusError`.

    Useful for `try...except` blocks when issuing a request,
    and then calling `.raise_for_status()`.

    For example:

    ```
    try:
        response = httpx.get("https://www.example.com")
        response.raise_for_status()
    except httpx.HTTPError as exc:
        print(f"HTTP Exception for {exc.request.url} - {exc}")
    ```
    ÚstrÚNone©ÚmessageÚreturnc                   s   t ƒ  |¡ d | _d S ©N©ÚsuperÚ__init__Ú_request©Úselfr%   ©Ú	__class__© ú_/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/httpx/_exceptions.pyr*   \   s    zHTTPError.__init__r   ©r&   c                 C  s   | j d u rtdƒ‚| j S )Nz'The .request property has not been set.)r+   ÚRuntimeError)r-   r0   r0   r1   Úrequest`   s    
zHTTPError.request©r4   r&   c                 C  s
   || _ d S r'   )r+   )r-   r4   r0   r0   r1   r4   f   s    )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r*   Úpropertyr4   ÚsetterÚ__classcell__r0   r0   r.   r1   r   J   s   r   c                      s0   e Zd ZdZddœddddœ‡ fdd	„Z‡  ZS )
r   zS
    Base class for all exceptions that may occur when issuing a `.request()`.
    N)r4   r"   úRequest | Noner#   )r%   r4   r&   c                  s   t ƒ  |¡ || _d S r'   r(   )r-   r%   r4   r.   r0   r1   r*   p   s    zRequestError.__init__©r6   r7   r8   r9   r*   r<   r0   r0   r.   r1   r   k   s   r   c                   @  s   e Zd ZdZdS )r   zU
    Base class for all exceptions that occur at the level of the Transport API.
    N©r6   r7   r8   r9   r0   r0   r0   r1   r   {   s   r   c                   @  s   e Zd ZdZdS )r   zM
    The base class for timeout errors.

    An operation has timed out.
    Nr?   r0   r0   r0   r1   r   „   s   r   c                   @  s   e Zd ZdZdS )r   z1
    Timed out while connecting to the host.
    Nr?   r0   r0   r0   r1   r   Œ   s   r   c                   @  s   e Zd ZdZdS )r   z7
    Timed out while receiving data from the host.
    Nr?   r0   r0   r0   r1   r   ’   s   r   c                   @  s   e Zd ZdZdS )r!   z3
    Timed out while sending data to the host.
    Nr?   r0   r0   r0   r1   r!   ˜   s   r!   c                   @  s   e Zd ZdZdS )r   zB
    Timed out waiting to acquire a connection from the pool.
    Nr?   r0   r0   r0   r1   r   ž   s   r   c                   @  s   e Zd ZdZdS )r   zo
    The base class for network-related errors.

    An error occurred while interacting with the network.
    Nr?   r0   r0   r0   r1   r   §   s   r   c                   @  s   e Zd ZdZdS )r   z2
    Failed to receive data from the network.
    Nr?   r0   r0   r0   r1   r   ¯   s   r   c                   @  s   e Zd ZdZdS )r    z2
    Failed to send data through the network.
    Nr?   r0   r0   r0   r1   r    µ   s   r    c                   @  s   e Zd ZdZdS )r   z+
    Failed to establish a connection.
    Nr?   r0   r0   r0   r1   r   »   s   r   c                   @  s   e Zd ZdZdS )r   z'
    Failed to close a connection.
    Nr?   r0   r0   r0   r1   r   Á   s   r   c                   @  s   e Zd ZdZdS )r   zB
    An error occurred while establishing a proxy connection.
    Nr?   r0   r0   r0   r1   r   Ê   s   r   c                   @  s   e Zd ZdZdS )r   z€
    Attempted to make a request to an unsupported protocol.

    For example issuing a request to `ftp://www.example.com`.
    Nr?   r0   r0   r0   r1   r   Ð   s   r   c                   @  s   e Zd ZdZdS )r   z$
    The protocol was violated.
    Nr?   r0   r0   r0   r1   r   Ø   s   r   c                   @  s   e Zd ZdZdS )r   zæ
    A protocol was violated by the client.

    For example if the user instantiated a `Request` instance explicitly,
    failed to include the mandatory `Host:` header, and then issued it directly
    using `client.send()`.
    Nr?   r0   r0   r0   r1   r   Þ   s   r   c                   @  s   e Zd ZdZdS )r   z^
    The protocol was violated by the server.

    For example, returning malformed HTTP.
    Nr?   r0   r0   r0   r1   r   è   s   r   c                   @  s   e Zd ZdZdS )r
   zG
    Decoding of the response failed, due to a malformed encoding.
    Nr?   r0   r0   r0   r1   r
   ó   s   r
   c                   @  s   e Zd ZdZdS )r   z
    Too many redirects.
    Nr?   r0   r0   r0   r1   r   ù   s   r   c                      s,   e Zd ZdZdddddœ‡ fdd„Z‡  ZS )	r   z|
    The response had an error HTTP status of 4xx or 5xx.

    May be raised when calling `response.raise_for_status()`
    r"   r   r   r#   )r%   r4   Úresponser&   c                  s   t ƒ  |¡ || _|| _d S r'   )r)   r*   r4   r@   )r-   r%   r4   r@   r.   r0   r1   r*   	  s    zHTTPStatusError.__init__r>   r0   r0   r.   r1   r     s   r   c                      s(   e Zd ZdZdddœ‡ fdd„Z‡  ZS )r   z7
    URL is improperly formed or cannot be parsed.
    r"   r#   r$   c                   s   t ƒ  |¡ d S r'   ©r)   r*   r,   r.   r0   r1   r*     s    zInvalidURL.__init__r>   r0   r0   r.   r1   r     s   r   c                      s(   e Zd ZdZdddœ‡ fdd„Z‡  ZS )r	   z†
    Attempted to lookup a cookie by name, but multiple cookies existed.

    Can occur when calling `response.cookies.get(...)`.
    r"   r#   r$   c                   s   t ƒ  |¡ d S r'   rA   r,   r.   r0   r1   r*     s    zCookieConflict.__init__r>   r0   r0   r.   r1   r	     s   r	   c                      s(   e Zd ZdZdddœ‡ fdd„Z‡  ZS )r   z‡
    The base class for stream exceptions.

    The developer made an error in accessing the request stream in
    an invalid way.
    r"   r#   r$   c                   s   t ƒ  |¡ d S r'   rA   r,   r.   r0   r1   r*   1  s    zStreamError.__init__r>   r0   r0   r.   r1   r   )  s   r   c                      s&   e Zd ZdZddœ‡ fdd„Z‡  ZS )r   z]
    Attempted to read or stream content, but the content has already
    been streamed.
    r#   r2   c                   s   d}t ƒ  |¡ d S )Na]  Attempted to read or stream some content, but the content has already been streamed. For requests, this could be due to passing a generator as request content, and then receiving a redirect response or a secondary request as part of an authentication flow.For responses, this could be due to attempting to stream the response content more than once.rA   r,   r.   r0   r1   r*   ;  s    ÿzStreamConsumed.__init__r>   r0   r0   r.   r1   r   5  s   r   c                      s&   e Zd ZdZddœ‡ fdd„Z‡  ZS )r   z\
    Attempted to read or stream response content, but the request has been
    closed.
    r#   r2   c                   s   d}t ƒ  |¡ d S )NzDAttempted to read or stream content, but the stream has been closed.rA   r,   r.   r0   r1   r*   M  s    ÿzStreamClosed.__init__r>   r0   r0   r.   r1   r   G  s   r   c                      s&   e Zd ZdZddœ‡ fdd„Z‡  ZS )r   zY
    Attempted to access streaming response content, without having called `read()`.
    r#   r2   c                   s   d}t ƒ  |¡ d S )NzOAttempted to access streaming response content, without having called `read()`.rA   r,   r.   r0   r1   r*   Y  s    ÿzResponseNotRead.__init__r>   r0   r0   r.   r1   r   T  s   r   c                      s&   e Zd ZdZddœ‡ fdd„Z‡  ZS )r   zX
    Attempted to access streaming request content, without having called `read()`.
    r#   r2   c                   s   d}t ƒ  |¡ d S )NzNAttempted to access streaming request content, without having called `read()`.rA   r,   r.   r0   r1   r*   f  s    ÿzRequestNotRead.__init__r>   r0   r0   r.   r1   r   a  s   r   r=   ztyping.Iterator[None]r5   c              
   c  sF   z
dV  W n6 t y@ } z| dur(| |_|‚W Y d}~n
d}~0 0 dS )z—
    A context manager that can be used to attach the given request context
    to any `RequestError` exceptions that are raised within the block.
    N)r   r4   )r4   Úexcr0   r0   r1   Úrequest_contextn  s    
rC   )N)*r9   Ú
__future__r   Ú
contextlibÚtypingÚTYPE_CHECKINGZ_modelsr   r   Ú__all__Ú	Exceptionr   r   r   r   r   r   r!   r   r   r   r    r   r   r   r   r   r   r   r
   r   r   r   r	   r3   r   r   r   r   r   ÚcontextmanagerrC   r0   r0   r0   r1   Ú<module>   sJ   ! !			
		 ÿ