o |nh&@sddlmZddlZddlZddlZddlmZddlmZ ej r9ddl m Z ddl mZddlmZdd lmZGd d d eZGd d d eZeejdefeedffZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ e Z!GdddeZ"GdddeZ#Gdd d eZ$Gd!d"d"eZ%Gd#d$d$e%eZ&Gd%d&d&e%Z'Gd'd(d(e'eZ(Gd)d*d*e(Z)Gd+d,d,eZ*Gd-d.d.eZ+Gd/d0d0eZ,Gd1d2d2e-eZ.Gd3d4d4e.Z/Gd5d6d6e.Z0Gd7d8d8eZ1Gd9d:d:eZ2Gd;d<dd>e2Z4Gd?d@d@e2Z5GdAdBdBe2Z6GdCdDdDeZ7GdEdFdFe e-Z8GdGdHdHeZ9GdIdJdJee ZGdKdLdLee Z:GdMdNdNeZ;GdOdPdPeGdSdTdTeZ?GdUdVdVeZ@dS)W) annotationsN) MessageDefect)IncompleteRead)HTTPConnection)ConnectionPool) HTTPResponse)Retryc@eZdZdZdS) HTTPErrorz#Base exception used by this module.N__name__ __module__ __qualname____doc__rrJ/usr/local/bin/dhwp/env/lib/python3.10/site-packages/urllib3/exceptions.pyr r c@r ) HTTPWarningz!Base warning used by this module.Nr rrrrrrr.cs,eZdZdZd fdd Zdd d ZZS) PoolErrorz/Base exception for errors caused within a pool.poolrmessagestrreturnNonec&||_||_t|d|dSNz: )r_messagesuper__init__)selfrr __class__rrr zPoolError.__init___TYPE_REDUCE_RESULTcC|jd|jffSNr"rr rrr __reduce__%zPoolError.__reduce__)rrrrrrrr$r rrrrr) __classcell__rrr!rrsrcs,eZdZdZdfd d Zdd d ZZS) RequestErrorz8Base exception for PoolErrors that have associated URLs.rrurlrrrrcs||_t||dSr&)r/rr)r rr/rr!rrr-szRequestError.__init__r$cC|jd|j|jffSr&)r"r/rr(rrrr)1zRequestError.__reduce__)rrr/rrrrrr+r,rrr!rr.*sr.c@r )SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr rrrrr26rr2cs,eZdZUdZded<d fd d ZZS) ProxyErrorz,Raised when the connection to a proxy fails. Exceptionoriginal_errorrrerrorrrcst||||_dSr&)rrr5)r rr6r!rrr@s zProxyError.__init__)rrr6r4rr)r rrr__annotations__rr-rrr!rr3:s r3c@r ) DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr rrrrr8Err8c@r ) ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr rrrrr9Irr9cs0eZdZdZ ddfd d ZdddZZS) MaxRetryErroraRaised when the maximum number of retries is exceeded. :param pool: The connection pool :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool` :param str url: The requested Url :param reason: The underlying error :type reason: :class:`Exception` Nrrr/rreasonException | Nonerrcs,||_d|d|d}t|||dS)NzMax retries exceeded with url: z (Caused by ))r;rr)r rr/r;rr!rrr_szMaxRetryError.__init__r$cCr0r&)r"r/r;r(rrrr)hr1zMaxRetryError.__reduce__r&)rrr/rr;r<rrr+r,rrr!rr:Ts   r:cs&eZdZdZ d dfd d ZZS)HostChangedErrorz?Raised when an existing pool gets a request for a foreign host.rrr/rretries Retry | intrrcs$d|}t|||||_dS)Nz'Tried to open a foreign host with url: )rrr@)r rr/r@rr!rrrps  zHostChangedError.__init__)r?)rrr/rr@rArrr rrrrr-rrr!rr>msr>c@r )TimeoutStateErrorz1Raised when passing an invalid state to a timeoutNr rrrrrCxrrCc@r ) TimeoutErrorzRaised when a socket timeout error occurs. Catching this error will catch both :exc:`ReadTimeoutErrors ` and :exc:`ConnectTimeoutErrors `. Nr rrrrrD|rrDc@r )ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr rrrrrErrEc@r )ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr rrrrrFrrFcs:eZdZdZdfdd Zdd d Zedd dZZS)NewConnectionErrorzHRaised when we fail to establish a new connection. Usually ECONNREFUSED.connrrrrrcrr)rHrrr)r rHrr!rrrr#zNewConnectionError.__init__r$cCr%r&r'r(rrrr)r*zNewConnectionError.__reduce__cCstjdtdd|jS)Nz\The 'pool' property is deprecated and will be removed in urllib3 v2.1.0. Use 'conn' instead.) stacklevel)warningswarnDeprecationWarningrHr(rrrrs zNewConnectionError.pool)rHrrrrrr+)rr) r rrrrr)propertyrr-rrr!rrGs  rGcs,eZdZdZdfdd Zdd d ZZS)NameResolutionErrorz'Raised when host name resolution fails.hostrrHrr;socket.gaierrorcs0d|d|d}||_||_t||dS)NzFailed to resolve 'z' (r=)_host_reasonrr)r rPrHr;rr!rrrszNameResolutionError.__init__rr$cCs|j|jd|jffSr&)r"rRrSr(rrrr)r1zNameResolutionError.__reduce__)rPrrHrr;rQr+r,rrr!rrOsrOc@r )EmptyPoolErrorzCRaised when a pool runs out of connections and no more are allowed.Nr rrrrrTrrTc@r ) FullPoolErrorzGRaised when we try to add a connection to a full pool in blocking mode.Nr rrrrrUrrUc@r )ClosedPoolErrorzCRaised when a request enters a pool after the pool has been closed.Nr rrrrrVrrVc@r )LocationValueErrorzProxy URL had no scheme, should start with http:// or https://z!Proxy URL had unsupported scheme z , should use http:// or https://rrr`r!rrr4s  zProxySchemeUnknown.__init__)r_r|rrrBrrr!rr{/sr{c@r )ProxySchemeUnsupportedz=Fetching HTTPS resources through HTTPS proxies is unsupportedNr rrrrr@rrcs"eZdZdZd fdd ZZS) HeaderParsingErrorzNRaised by assert_header_parsing, but we convert it to a log.warning statement.defectslist[MessageDefect] unparsed_databytes | str | Nonerrcs"|pdd|}t|dS)NUnknownz, unparsed data: r~)r rrrr!rrrGszHeaderParsingError.__init__)rrrrrrrBrrr!rrDr]rc@r )UnrewindableBodyErrorz9urllib3 encountered an error when trying to rewind a bodyNr rrrrrNrr)A __future__rsockettypingrK email.errorsr http.clientrhttplib_IncompleteRead TYPE_CHECKING connectionrconnectionpoolrrur util.retryr r4r WarningrtupleCallableobjectr$rr.r2r3r8r9ConnectionErrorr:r>rCrDrErFrGrOrTrUrV ValueErrorrWrYr^rardrerfrgrhrirjrkrtrzAssertionErrorr{rrrrrrrsf