
    osj"                       d Z ddlmZ ddlZddlZddlm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 d0 d1e      Z" G d2 d3e      Z# G d4 d5e      Z$ G d6 d7e      Z% G d8 d9e&      Z' G d: d;e'      Z( G d< d=e'      Z) G d> d?e'      Z* G d@ dAe'      Z+ejX                  dCdDdB       Z-y)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)	Generator   )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y)HTTPXDeprecationWarninga_  A custom deprecation warning for HTTPX.

    Unlike the built-in `DeprecationWarning`, this inherits from `UserWarning` to ensure it is visible by default,
    helping users discover deprecated features without needing to enable warnings explicitly.

    Reference: https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries
    N__name__
__module____qualname____doc__     E/root/.hermes/venv/lib/python3.12/site-packages/httpx2/_exceptions.pyr%   r%   K       r,   r%   c                  \     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 = httpx2.get("https://www.example.com")
        response.raise_for_status()
    except httpx2.HTTPError as exc:
        print(f"HTTP Exception for {exc.request.url} - {exc}")
    ```
    c                2    t         |   |       d | _        y Nsuper__init___requestselfmessage	__class__s     r-   r4   zHTTPError.__init__g   s    !(,r,   c                H    | j                   t        d      | j                   S )Nz'The .request property has not been set.)r5   RuntimeError)r7   s    r-   requestzHTTPError.requestk   s"    == HII}}r,   c                    || _         y r1   )r5   )r7   r<   s     r-   r<   zHTTPError.requestq   s	    r,   r8   strreturnNone)r@   r   )r<   r   r@   rA   )	r'   r(   r)   r*   r4   propertyr<   setter__classcell__r9   s   @r-   r   r   U   s9    "-  
 ^^   r,   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)r<   c               2    t         |   |       || _        y r1   r2   )r7   r8   r<   r9   s      r-   r4   zRequestError.__init__{   s    !  r,   )r8   r?   r<   Request | Noner@   rA   r'   r(   r)   r*   r4   rD   rE   s   @r-   r   r   v   s     CG    r,   r   c                      e Zd ZdZy)r    zU
    Base class for all exceptions that occur at the level of the Transport API.
    Nr&   r+   r,   r-   r    r           r,   r    c                      e Zd ZdZy)r   zM
    The base class for timeout errors.

    An operation has timed out.
    Nr&   r+   r,   r-   r   r          r,   r   c                      e Zd ZdZy)r
   z1
    Timed out while connecting to the host.
    Nr&   r+   r,   r-   r
   r
      rK   r,   r
   c                      e Zd ZdZy)r   z7
    Timed out while receiving data from the host.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r#   z3
    Timed out while sending data to the host.
    Nr&   r+   r,   r-   r#   r#      rK   r,   r#   c                      e Zd ZdZy)r   zB
    Timed out waiting to acquire a connection from the pool.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r   zo
    The base class for network-related errors.

    An error occurred while interacting with the network.
    Nr&   r+   r,   r-   r   r      rM   r,   r   c                      e Zd ZdZy)r   z2
    Failed to receive data from the network.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r"   z2
    Failed to send data through the network.
    Nr&   r+   r,   r-   r"   r"      rK   r,   r"   c                      e Zd ZdZy)r	   z+
    Failed to establish a connection.
    Nr&   r+   r,   r-   r	   r	      rK   r,   r	   c                      e Zd ZdZy)r   z'
    Failed to close a connection.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r   zB
    An error occurred while establishing a proxy connection.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r!   z
    Attempted to make a request to an unsupported protocol.

    For example issuing a request to `ftp://www.example.com`.
    Nr&   r+   r,   r-   r!   r!      rM   r,   r!   c                      e Zd ZdZy)r   z$
    The protocol was violated.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)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&   r+   r,   r-   r   r      r.   r,   r   c                      e Zd ZdZy)r   z^
    The protocol was violated by the server.

    For example, returning malformed HTTP.
    Nr&   r+   r,   r-   r   r      rM   r,   r   c                      e Zd ZdZy)r   zG
    Decoding of the response failed, due to a malformed encoding.
    Nr&   r+   r,   r-   r   r      rK   r,   r   c                      e Zd ZdZy)r   z
    Too many redirects.
    Nr&   r+   r,   r-   r   r     rK   r,   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()`
    c               @    t         |   |       || _        || _        y r1   )r3   r4   r<   response)r7   r8   r<   r`   r9   s       r-   r4   zHTTPStatusError.__init__  s    ! r,   )r8   r?   r<   r   r`   r   r@   rA   rI   rE   s   @r-   r   r     s    ! !r,   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.
    c                $    t         |   |       y r1   r3   r4   r6   s     r-   r4   zInvalidURL.__init__      !r,   r>   rI   rE   s   @r-   r   r     s    " "r,   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(...)`.
    c                $    t         |   |       y r1   rc   r6   s     r-   r4   zCookieConflict.__init__*  rd   r,   r>   rI   rE   s   @r-   r   r   #  s    " "r,   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.
    c                $    t         |   |       y r1   rc   r6   s     r-   r4   zStreamError.__init__<  rd   r,   r>   rI   rE   s   @r-   r   r   4  s    " "r,   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.
    c                (    d}t         |   |       y )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.rc   r6   s     r-   r4   zStreamConsumed.__init__F  s    & 	 	!r,   r@   rA   rI   rE   s   @r-   r   r   @  s    
	" 	"r,   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.
    c                (    d}t         |   |       y )NzDAttempted to read or stream content, but the stream has been closed.rc   r6   s     r-   r4   zStreamClosed.__init__X  s    X!r,   rk   rI   rE   s   @r-   r   r   R  s    
" "r,   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()`.
    c                (    d}t         |   |       y )NzOAttempted to access streaming response content, without having called `read()`.rc   r6   s     r-   r4   zResponseNotRead.__init__b  s    c!r,   rk   rI   rE   s   @r-   r   r   ]      " "r,   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()`.
    c                (    d}t         |   |       y )NzNAttempted to access streaming request content, without having called `read()`.rc   r6   s     r-   r4   zRequestNotRead.__init__l  s    b!r,   rk   rI   rE   s   @r-   r   r   g  rp   r,   r   c              #  N   K   	 d y# t         $ r}| | |_        |d}~ww xY w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   r<   )r<   excs     r-   request_contextru   q  s/      !CK	s   %	 %	""%r1   )r<   rH   r@   zGenerator[None]).r*   
__future__r   
contextlibtypingcollections.abcr   TYPE_CHECKING_modelsr   r   __all__UserWarningr%   	Exceptionr   r   r    r   r
   r   r#   r   r   r   r"   r	   r   r   r!   r   r   r   r   r   r   r   r   r;   r   r   r   r   r   contextmanagerru   r+   r,   r-   <module>r      s  B #   %	*@k  	  B 9   \ ~ % " # " >   <   . N  - L | 
!i 
!" ""Y ""	", 	""[ "$"; ""k ""[ " 
 
r,   