xj"dZddlmZddlZddlZddlmZejrddlm Z m Z gdZ Gdd e Z Gd d eZGd d eZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGd d!eZGd"d#eZGd$d%eZGd&d'eZGd(d)eZGd*d+eZGd,d-eZ Gd.d/eZ!Gd0d1eZ"Gd2d3eZ#Gd4d5eZ$Gd6d7eZ%Gd8d9e&Z'Gd:d;e'Z(Gd<d=e'Z)Gd>d?e'Z*Gd@dAe'Z+ejXdCdDdBZ-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)RequestResponse) CloseError ConnectErrorConnectTimeoutCookieConflict DecodingError HTTPErrorHTTPStatusError InvalidURLLocalProtocolError NetworkError PoolTimeout ProtocolError ProxyError ReadError ReadTimeoutRemoteProtocolError RequestErrorRequestNotReadResponseNotRead StreamClosedStreamConsumed StreamErrorTimeoutExceptionTooManyRedirectsTransportErrorUnsupportedProtocol WriteError WriteTimeoutceZdZdZy)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__f/mnt/ssd/data/Dropbox/adrian/sandbox/mcp-query/venv/lib/python3.12/site-packages/httpx2/_exceptions.pyr%r%Kr,r%c\eZdZdZdfd ZeddZejddZxZS)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}") ``` c2t||d|_yNsuper__init___requestselfmessage __class__s r-r4zHTTPError.__init__gs !(, r,cH|j td|jS)Nz'The .request property has not been set.)r5 RuntimeError)r7s r-requestzHTTPError.requestks" == HI I}}r,c||_yr1)r5)r7r<s r-r<zHTTPError.requestqs  r,r8strreturnNone)r@r)r<rr@rA) r'r(r)r*r4propertyr<setter __classcell__r9s@r-r r Us9"-  ^^  r,r c*eZdZdZdddfdZxZS)rzS Base class for all exceptions that may occur when issuing a `.request()`. N)r<c2t||||_yr1r2)r7r8r<r9s r-r4zRequestError.__init__{s !  r,)r8r?r<Request | Noner@rAr'r(r)r*r4rDrEs@r-rrvsCG  r,rceZdZdZy)r zU Base class for all exceptions that occur at the level of the Transport API. Nr&r+r,r-r r r,r ceZdZdZy)rzM The base class for timeout errors. An operation has timed out. Nr&r+r,r-rrr,rceZdZdZy)r z1 Timed out while connecting to the host. Nr&r+r,r-r r rKr,r ceZdZdZy)rz7 Timed out while receiving data from the host. Nr&r+r,r-rrrKr,rceZdZdZy)r#z3 Timed out while sending data to the host. Nr&r+r,r-r#r#rKr,r#ceZdZdZy)rzB Timed out waiting to acquire a connection from the pool. Nr&r+r,r-rrrKr,rceZdZdZy)rzo The base class for network-related errors. An error occurred while interacting with the network. Nr&r+r,r-rrrMr,rceZdZdZy)rz2 Failed to receive data from the network. Nr&r+r,r-rrrKr,rceZdZdZy)r"z2 Failed to send data through the network. Nr&r+r,r-r"r"rKr,r"ceZdZdZy)r z+ Failed to establish a connection. Nr&r+r,r-r r rKr,r ceZdZdZy)rz' Failed to close a connection. Nr&r+r,r-rrrKr,rceZdZdZy)rzB An error occurred while establishing a proxy connection. Nr&r+r,r-rrrKr,rceZdZdZy)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!rMr,r!ceZdZdZy)rz$ The protocol was violated. Nr&r+r,r-rrrKr,rceZdZdZy)rz 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-rrr.r,rceZdZdZy)rz^ The protocol was violated by the server. For example, returning malformed HTTP. Nr&r+r,r-rrrMr,rceZdZdZy)r zG Decoding of the response failed, due to a malformed encoding. Nr&r+r,r-r r rKr,r ceZdZdZy)rz Too many redirects. Nr&r+r,r-rrrKr,rc$eZdZdZdfd ZxZS)rz| The response had an error HTTP status of 4xx or 5xx. May be raised when calling `response.raise_for_status()` c@t||||_||_yr1)r3r4r<response)r7r8r<r`r9s r-r4zHTTPStatusError.__init__s !   r,)r8r?r<rr`rr@rArIrEs@r-rr s !!r,rc$eZdZdZdfd ZxZS)rz7 URL is improperly formed or cannot be parsed. c$t||yr1r3r4r6s r-r4zInvalidURL.__init__ !r,r>rIrEs@r-rrs""r,rc$eZdZdZdfd ZxZS)r z Attempted to lookup a cookie by name, but multiple cookies existed. Can occur when calling `response.cookies.get(...)`. c$t||yr1rcr6s r-r4zCookieConflict.__init__*rdr,r>rIrEs@r-r r #s ""r,r c$eZdZdZdfd ZxZS)rz The base class for stream exceptions. The developer made an error in accessing the request stream in an invalid way. c$t||yr1rcr6s r-r4zStreamError.__init__<rdr,r>rIrEs@r-rr4s""r,rc$eZdZdZdfd ZxZS)rz] 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.rcr6s r-r4zStreamConsumed.__init__Fs &  !r,r@rArIrEs@r-rr@s " "r,rc$eZdZdZdfd ZxZS)rz\ 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.rcr6s r-r4zStreamClosed.__init__XsX !r,rkrIrEs@r-rrRs ""r,rc$eZdZdZdfd ZxZS)rzY Attempted to access streaming response content, without having called `read()`. c(d}t||y)NzOAttempted to access streaming response content, without having called `read()`.rcr6s r-r4zResponseNotRead.__init__bsc !r,rkrIrEs@r-rr]""r,rc$eZdZdZdfd ZxZS)rzX Attempted to access streaming request content, without having called `read()`. c(d}t||y)NzNAttempted to access streaming request content, without having called `read()`.rcr6s r-r4zRequestNotRead.__init__lsb !r,rkrIrEs@r-rrgrpr,rc#NK dy#t$r}|||_|d}~wwxYww)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)rr<)r<excs r-request_contextruqs/    !CK s% % " "%r1)r<rHr@zGenerator[None]).r* __future__r contextlibtypingcollections.abcr TYPE_CHECKING_modelsrr__all__ UserWarningr% Exceptionr rr rr rr#rrrr"r rrr!rrrr rrrr r;rrrrrcontextmanagerrur+r,r-rsB# % * @k  B  9  \~% " # ">   <  .N -L | !i !"""Y"" ", ""["$";""k""["   r,