U e$@s ddlmZddlZddlZddlZddlmZddlmZ ej rrddl m Z ddl mZddlmZdd lmZGd d d eZGd d d eZejejdefejedffZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZ 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@seZdZdZdS) HTTPErrorz#Base exception used by this module.N__name__ __module__ __qualname____doc__rr@/opt/hc_python/lib/python3.8/site-packages/urllib3/exceptions.pyr sr c@seZdZdZdS) HTTPWarningz!Base warning used by this module.Nr rrrrrsr.cs8eZdZdZddddfdd Zdd d d ZZS) PoolErrorz/Base exception for errors caused within a pool.rstrNone)poolmessagereturncs ||_t|d|dSNz: )rsuper__init__)selfrr __class__rrr"szPoolError.__init___TYPE_REDUCE_RESULTrcCs |jdfS)N)NNrrrrr __reduce__&szPoolError.__reduce__r r rrrr" __classcell__rrrrrsrcs:eZdZdZdddddfdd Zdd d d ZZS) RequestErrorz8Base exception for PoolErrors that have associated URLs.rrr)rurlrrcs||_t||dSN)r&rr)rrr&rrrrr.szRequestError.__init__rr cCs|jd|jdffSr')rr&r!rrrr"2szRequestError.__reduce__r#rrrrr%+sr%c@seZdZdZdS)SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr rrrrr(7sr(cs4eZdZUdZded<ddddfdd ZZS) ProxyErrorz,Raised when the connection to a proxy fails. Exceptionoriginal_errorrr)rerrorrcst||||_dSr')rrr+)rrr,rrrrAszProxyError.__init__)r r rr__annotations__rr$rrrrr);s r)c@seZdZdZdS) DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr rrrrr.Fsr.c@seZdZdZdS) ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr rrrrr/Jsr/cs.eZdZdZd dddddfdd ZZS) 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` NrrzException | Noner)rr&reasonrcs,||_d|d|d}t|||dS)NzMax retries exceeded with url: z (Caused by ))r1rr)rrr&r1rrrrr`szMaxRetryError.__init__)Nr r rrrr$rrrrr0Us r0cs.eZdZdZd dddddfdd ZZS) HostChangedErrorz?Raised when an existing pool gets a request for a foreign host.rrz Retry | intr)rr&retriesrcs$d|}t|||||_dS)Nz'Tried to open a foreign host with url: )rrr6)rrr&r6rrrrrms zHostChangedError.__init__)r5r3rrrrr4jsr4c@seZdZdZdS)TimeoutStateErrorz1Raised when passing an invalid state to a timeoutNr rrrrr7usr7c@seZdZdZdS) TimeoutErrorzRaised when a socket timeout error occurs. Catching this error will catch both :exc:`ReadTimeoutErrors ` and :exc:`ConnectTimeoutErrors `. Nr rrrrr8ysr8c@seZdZdZdS)ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr rrrrr9sr9c@seZdZdZdS)ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr rrrrr:sr:cs<eZdZdZddddfdd Zeddd d ZZS) NewConnectionErrorzHRaised when we fail to establish a new connection. Usually ECONNREFUSED.rrr)connrrcs ||_t|d|dSr)r<rr)rr<rrrrrszNewConnectionError.__init__r cCstjdtdd|jS)Nz\The 'pool' property is deprecated and will be removed in urllib3 v2.1.0. Use 'conn' instead.) stacklevel)warningswarnDeprecationWarningr<r!rrrrs zNewConnectionError.pool)r r rrrpropertyrr$rrrrr;sr;cs*eZdZdZddddfdd ZZS)NameResolutionErrorz'Raised when host name resolution fails.rrzsocket.gaierror)hostr<r1cs$d|d|d}t||dS)NzFailed to resolve 'z' (r2rr)rrDr<r1rrrrrszNameResolutionError.__init__r3rrrrrCsrCc@seZdZdZdS)EmptyPoolErrorzCRaised when a pool runs out of connections and no more are allowed.Nr rrrrrFsrFc@seZdZdZdS) FullPoolErrorzGRaised when we try to add a connection to a full pool in blocking mode.Nr rrrrrGsrGc@seZdZdZdS)ClosedPoolErrorzCRaised when a request enters a pool after the pool has been closed.Nr rrrrrHsrHc@seZdZdZdS)LocationValueErrorzProxy URL had no scheme, should start with http:// or https://z!Proxy URL had unsupported scheme z , should use http:// or https://rErNrrrr&s  zProxySchemeUnknown.__init__r3rrrrrf!srfc@seZdZdZdS)ProxySchemeUnsupportedz=Fetching HTTPS resources through HTTPS proxies is unsupportedNr rrrrrh2srhcs*eZdZdZddddfdd ZZS)HeaderParsingErrorzNRaised by assert_header_parsing, but we convert it to a log.warning statement.zlist[MessageDefect]zbytes | str | Noner)defects unparsed_datarcs"|pdd|}t|dS)NUnknownz, unparsed data: rE)rrjrkrrrrr9szHeaderParsingError.__init__r3rrrrri6sric@seZdZdZdS)UnrewindableBodyErrorz9urllib3 encountered an error when trying to rewind a bodyNr rrrrrm@srm)A __future__rsockettypingr?Z email.errorsr http.clientrhttplib_IncompleteRead TYPE_CHECKING connectionrconnectionpoolrrarZ util.retryr r*r WarningrTupleCallableobjectrrr%r(r)r.r/ConnectionErrorr0r4r7r8r9r:r;rCrFrGrH ValueErrorrIrJrLrOrRrSrTrUrVrWrXrYr_reAssertionErrorrfrhrirmrrrrsh