
    hO!                       d Z ddlmZ ddlZddlZej        rddlmZmZ g dZ	 G d de
          Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z G d% d&e          Z G d' d(e          Z G d) d*e          Z G d+ d,e          Z G d- d.e          Z G d/ d0e          Z G d1 d2e
          Z  G d3 d4e
          Z! G d5 d6e"          Z# G d7 d8e#          Z$ G d9 d:e#          Z% G d; d<e#          Z& G d= d>e#          Z'ej(        	 dDdEdC            Z)dS )Ful  
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                  ^     e Zd ZdZd fdZedd            Zej        dd
            Z x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}")
    ```
    messagestrreturnNonec                X    t                                          |           d | _        d S Nsuper__init___requestselfr$   	__class__s     S/var/www/html/prod/cognitive/venv/lib/python3.11/site-packages/httpx/_exceptions.pyr,   zHTTPError.__init__\   s&    !!!(,    r   c                <    | j         t          d          | j         S )Nz'The .request property has not been set.)r-   RuntimeError)r/   s    r1   requestzHTTPError.request`   s!    = HIII}r2   r5   c                    || _         d S r)   )r-   )r/   r5   s     r1   r5   zHTTPError.requestf   s    r2   r$   r%   r&   r'   )r&   r   )r5   r   r&   r'   )	__name__
__module____qualname____doc__r,   propertyr5   setter__classcell__r0   s   @r1   r   r   J   s         "- - - - - -    X
 ^      ^         r2   r   c                  *     e Zd ZdZddd fd
Z xZS )r   zS
    Base class for all exceptions that may occur when issuing a `.request()`.
    N)r5   r$   r%   r5   Request | Noner&   r'   c               X    t                                          |           || _        d S r)   r*   )r/   r$   r5   r0   s      r1   r,   zRequestError.__init__p   s(    !!!  r2   )r$   r%   r5   rA   r&   r'   r8   r9   r:   r;   r,   r>   r?   s   @r1   r   r   k   sX          CG                        r2   r   c                      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r8   r9   r:   r;    r2   r1   r   r   {              r2   r   c                      e Zd ZdZdS )r   zM
    The base class for timeout errors.

    An operation has timed out.
    NrE   rF   r2   r1   r   r                 r2   r   c                      e Zd ZdZdS )r	   z1
    Timed out while connecting to the host.
    NrE   rF   r2   r1   r	   r	      rG   r2   r	   c                      e Zd ZdZdS )r   z7
    Timed out while receiving data from the host.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      e Zd ZdZdS )r"   z3
    Timed out while sending data to the host.
    NrE   rF   r2   r1   r"   r"      rG   r2   r"   c                      e Zd ZdZdS )r   zB
    Timed out waiting to acquire a connection from the pool.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      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.
    NrE   rF   r2   r1   r   r      rI   r2   r   c                      e Zd ZdZdS )r   z2
    Failed to receive data from the network.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      e Zd ZdZdS )r!   z2
    Failed to send data through the network.
    NrE   rF   r2   r1   r!   r!      rG   r2   r!   c                      e Zd ZdZdS )r   z+
    Failed to establish a connection.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      e Zd ZdZdS )r   z'
    Failed to close a connection.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      e Zd ZdZdS )r   zB
    An error occurred while establishing a proxy connection.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      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`.
    NrE   rF   r2   r1   r    r       rI   r2   r    c                      e Zd ZdZdS )r   z$
    The protocol was violated.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      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()`.
    NrE   rF   r2   r1   r   r      s           r2   r   c                      e Zd ZdZdS )r   z^
    The protocol was violated by the server.

    For example, returning malformed HTTP.
    NrE   rF   r2   r1   r   r      rI   r2   r   c                      e Zd ZdZdS )r   zG
    Decoding of the response failed, due to a malformed encoding.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                      e Zd ZdZdS )r   z
    Too many redirects.
    NrE   rF   r2   r1   r   r      rG   r2   r   c                  $     e Zd ZdZd fd
Z x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%   r5   r   responser   r&   r'   c               f    t                                          |           || _        || _        d S r)   )r+   r,   r5   r[   )r/   r$   r5   r[   r0   s       r1   r,   zHTTPStatusError.__init__	  s-    !!! r2   )r$   r%   r5   r   r[   r   r&   r'   rC   r?   s   @r1   r   r     sG         ! ! ! ! ! ! ! ! ! !r2   r   c                  $     e Zd ZdZd fdZ xZS )r   z7
    URL is improperly formed or cannot be parsed.
    r$   r%   r&   r'   c                J    t                                          |           d S r)   r+   r,   r.   s     r1   r,   zInvalidURL.__init__  !    !!!!!r2   r7   rC   r?   s   @r1   r   r     sG         " " " " " " " " " "r2   r   c                  $     e Zd ZdZd fdZ x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&   r'   c                J    t                                          |           d S r)   r_   r.   s     r1   r,   zCookieConflict.__init__  r`   r2   r7   rC   r?   s   @r1   r
   r
     sG         " " " " " " " " " "r2   r
   c                  $     e Zd ZdZd fdZ x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&   r'   c                J    t                                          |           d S r)   r_   r.   s     r1   r,   zStreamError.__init__1  r`   r2   r7   rC   r?   s   @r1   r   r   )  sG         " " " " " " " " " "r2   r   c                  $     e Zd ZdZd fdZ xZS )r   z]
    Attempted to read or stream content, but the content has already
    been streamed.
    r&   r'   c                N    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.r_   r.   s     r1   r,   zStreamConsumed.__init__;  s-    & 	 	!!!!!r2   r&   r'   rC   r?   s   @r1   r   r   5  sG         
	" 	" 	" 	" 	" 	" 	" 	" 	" 	"r2   r   c                  $     e Zd ZdZd fdZ xZS )r   z\
    Attempted to read or stream response content, but the request has been
    closed.
    r&   r'   c                N    d}t                                          |           d S )NzDAttempted to read or stream content, but the stream has been closed.r_   r.   s     r1   r,   zStreamClosed.__init__M  s+    U 	 	!!!!!r2   rg   rC   r?   s   @r1   r   r   G  sG         
" " " " " " " " " "r2   r   c                  $     e Zd ZdZd fdZ xZS )r   zY
    Attempted to access streaming response content, without having called `read()`.
    r&   r'   c                N    d}t                                          |           d S )NzOAttempted to access streaming response content, without having called `read()`.r_   r.   s     r1   r,   zResponseNotRead.__init__Y  -    / 	 	!!!!!r2   rg   rC   r?   s   @r1   r   r   T  G         " " " " " " " " " "r2   r   c                  $     e Zd ZdZd fdZ xZS )r   zX
    Attempted to access streaming request content, without having called `read()`.
    r&   r'   c                N    d}t                                          |           d S )NzNAttempted to access streaming request content, without having called `read()`.r_   r.   s     r1   r,   zRequestNotRead.__init__f  rl   r2   rg   rC   r?   s   @r1   r   r   a  rm   r2   r   r5   rA   r&   typing.Iterator[None]c              #  N   K   	 dV  dS # t           $ r}| | |_        |d}~ww xY w)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   r5   )r5   excs     r1   request_contextrs   n  sI         !CK	s   
 
$$r)   )r5   rA   r&   rp   )*r;   
__future__r   
contextlibtypingTYPE_CHECKING_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
   r4   r   r   r   r   r   contextmanagerrs   rF   r2   r1   <module>r|      sA   B # " " " " "     	 +********  @         	      B         9           \       ~       %       "       #       "       >                     <                     .       N              -       L       |   
! 
! 
! 
! 
!i 
! 
! 
!" " " " " " " "" " " " "Y " " ""	" 	" 	" 	" 	", 	" 	" 	"" " " " "[ " " "$
" 
" 
" 
" 
"; 
" 
" 
"
" 
" 
" 
" 
"k 
" 
" 
"
" 
" 
" 
" 
"[ 
" 
" 
" "      r2   