
    wOg$                       d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ	 ej
        rddlmZ ddlmZ ddlmZ dd	lmZ  G d
 de          Z G d de          Zej        ej        def         ej        edf         f         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 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%e          Z& G d% d&e%          Z' G d' d(e'e          Z( G d) d*e(          Z) G d+ d,e          Z* G d- d.e          Z+ G d/ d0e          Z, G d1 d2e-e          Z. G d3 d4e.          Z/ G d5 d6e.          Z0 G d7 d8e          Z1 G d9 d:e          Z2 G d; d<e2          Z3 G d= d>e2          Z4 G d? d@e2          Z5 G dA dBe2          Z6 G dC dDe          Z7 G dE dFe e-          Z8 G dG dHe          Z9 G dI dJee	          Z G dK dLee	          Z: G dM dNe          Z; G dO dPe<e0          Z= G dQ dRe-          Z> G dS dTe          Z? G dU dVe          Z@dS )W    )annotationsN)MessageDefect)IncompleteRead   )HTTPConnection)ConnectionPool)HTTPResponse)Retryc                      e Zd ZdZdS )	HTTPErrorz#Base exception used by this module.N__name__
__module____qualname____doc__     L/var/www/AppWebDeiv/myenv/lib/python3.11/site-packages/urllib3/exceptions.pyr   r      s        ----r   r   c                      e Zd ZdZdS )HTTPWarningz!Base warning used by this module.Nr   r   r   r   r   r      s        ++++r   r   .c                  ,     e Zd ZdZd fdZdd
Z xZS )	PoolErrorz/Base exception for errors caused within a pool.poolr   messagestrreturnNonec                b    || _         t                                          | d|            d S Nz: )r   super__init__)selfr   r   	__class__s      r   r!   zPoolError.__init__"   6    	D--G--.....r   _TYPE_REDUCE_RESULTc                    | j         dfS )N)NNr#   r"   s    r   
__reduce__zPoolError.__reduce__&   s    ~|++r   )r   r   r   r   r   r   r   r%   r   r   r   r   r!   r)   __classcell__r'   s   @r   r   r      sW        99/ / / / / /, , , , , , , ,r   r   c                  ,     e Zd ZdZd fd	ZddZ xZS )RequestErrorz8Base exception for PoolErrors that have associated URLs.r   r   urlr   r   r   r   c                Z    || _         t                                          ||           d S N)r/   r    r!   )r"   r   r/   r   r#   s       r   r!   zRequestError.__init__.   s*    w'''''r   r%   c                $    | j         d | j        d ffS r1   )r#   r/   r(   s    r   r)   zRequestError.__reduce__2   s    ~dh555r   )r   r   r/   r   r   r   r   r   r*   r+   r'   s   @r   r.   r.   +   sW        BB( ( ( ( ( (6 6 6 6 6 6 6 6r   r.   c                      e Zd ZdZdS )SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr   r   r   r   r4   r4   7           CCCCr   r4   c                  0     e Zd ZU dZded<   d
 fd	Z xZS )
ProxyErrorz,Raised when the connection to a proxy fails.	Exceptionoriginal_errorr   r   errorr   r   c                Z    t                                          ||           || _        d S r1   )r    r!   r9   )r"   r   r:   r#   s      r   r!   zProxyError.__init__A   s+    %(((#r   )r   r   r:   r8   r   r   )r   r   r   r   __annotations__r!   r,   r'   s   @r   r7   r7   ;   sS         66 $ $ $ $ $ $ $ $ $ $r   r7   c                      e Zd ZdZdS )DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr   r   r   r   r>   r>   F           EEEEr   r>   c                      e Zd ZdZdS )ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr   r   r   r   rA   rA   J   s        HHHHr   rA   c                  (     e Zd ZdZ	 dd fdZ xZS )MaxRetryErrora  Raised 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`

    Nr   r   r/   r   reasonException | Noner   r   c                n    || _         d| d|d}t                                          |||           d S )NzMax retries exceeded with url: z (Caused by ))rD   r    r!   )r"   r   r/   rD   r   r#   s        r   r!   zMaxRetryError.__init__`   sF     PCPPVPPPsG,,,,,r   r1   )r   r   r/   r   rD   rE   r   r   r   r   r   r   r!   r,   r'   s   @r   rC   rC   U   sS          JN- - - - - - - - - - -r   rC   c                  (     e Zd ZdZ	 dd fdZ xZS )HostChangedErrorz?Raised when an existing pool gets a request for a foreign host.   r   r   r/   r   retriesRetry | intr   r   c                f    d| }t                                          |||           || _        d S )Nz'Tried to open a foreign host with url: )r    r!   rL   )r"   r   r/   rL   r   r#   s        r   r!   zHostChangedError.__init__m   s:     BCAAsG,,,r   )rK   )r   r   r/   r   rL   rM   r   r   rH   r'   s   @r   rJ   rJ   j   sO        II FG          r   rJ   c                      e Zd ZdZdS )TimeoutStateErrorz1Raised when passing an invalid state to a timeoutNr   r   r   r   rP   rP   u   s        ;;;;r   rP   c                      e Zd ZdZdS )TimeoutErrorzRaised when a socket timeout error occurs.

    Catching this error will catch both :exc:`ReadTimeoutErrors
    <ReadTimeoutError>` and :exc:`ConnectTimeoutErrors <ConnectTimeoutError>`.
    Nr   r   r   r   rR   rR   y   s           r   rR   c                      e Zd ZdZdS )ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr   r   r   r   rT   rT      s        PPPPr   rT   c                      e Zd ZdZdS )ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr   r   r   r   rV   rV      s        JJJJr   rV   c                  <     e Zd ZdZd
 fdZedd	            Z xZS )NewConnectionErrorzHRaised when we fail to establish a new connection. Usually ECONNREFUSED.connr   r   r   r   r   c                b    || _         t                                          | d|            d S r   )rY   r    r!   )r"   rY   r   r#   s      r   r!   zNewConnectionError.__init__   r$   r   c                H    t          j        dt          d           | j        S )Nz\The 'pool' property is deprecated and will be removed in urllib3 v2.1.0. Use 'conn' instead.   )
stacklevel)warningswarnDeprecationWarningrY   r(   s    r   r   zNewConnectionError.pool   s0    5		
 	
 	
 	
 yr   )rY   r   r   r   r   r   )r   r   )r   r   r   r   r!   propertyr   r,   r'   s   @r   rX   rX      sc        RR/ / / / / /    X    r   rX   c                  $     e Zd ZdZd	 fdZ xZS )
NameResolutionErrorz'Raised when host name resolution fails.hostr   rY   r   rD   socket.gaierrorc                ^    d| d| d}t                                          ||           d S )NzFailed to resolve 'z' (rG   r    r!   )r"   rd   rY   rD   r   r#   s        r   r!   zNameResolutionError.__init__   s;    ::::::w'''''r   )rd   r   rY   r   rD   re   rH   r'   s   @r   rc   rc      sC        11( ( ( ( ( ( ( ( ( (r   rc   c                      e Zd ZdZdS )EmptyPoolErrorzCRaised when a pool runs out of connections and no more are allowed.Nr   r   r   r   ri   ri              MMMMr   ri   c                      e Zd ZdZdS )FullPoolErrorzGRaised when we try to add a connection to a full pool in blocking mode.Nr   r   r   r   rl   rl      s        QQQQr   rl   c                      e Zd ZdZdS )ClosedPoolErrorzCRaised when a request enters a pool after the pool has been closed.Nr   r   r   r   rn   rn      rj   r   rn   c                      e Zd ZdZdS )LocationValueErrorz<Raised when there is something wrong with a given URL input.Nr   r   r   r   rp   rp      s        FFFFr   rp   c                  $     e Zd ZdZd fdZ xZS )LocationParseErrorz=Raised when get_host or similar fails to parse the URL input.locationr   r   r   c                b    d| }t                                          |           || _        d S )NzFailed to parse: )r    r!   rs   )r"   rs   r   r#   s      r   r!   zLocationParseError.__init__   s3    0h00!!! r   )rs   r   r   r   rH   r'   s   @r   rr   rr      sC        GG! ! ! ! ! ! ! ! ! !r   rr   c                  $     e Zd ZdZd fdZ xZS )URLSchemeUnknownz2Raised when a URL input has an unsupported scheme.schemer   c                b    d| }t                                          |           || _        d S )NzNot supported URL scheme )r    r!   rw   r"   rw   r   r#   s      r   r!   zURLSchemeUnknown.__init__   s3    6f66!!!r   )rw   r   rH   r'   s   @r   rv   rv      sC        <<         r   rv   c                      e Zd ZdZdZdZdS )ResponseErrorzDUsed as a container for an error reason supplied in a MaxRetryError.ztoo many error responsesz&too many {status_code} error responsesN)r   r   r   r   GENERIC_ERRORSPECIFIC_ERRORr   r   r   r{   r{      s        NN.M=NNNr   r{   c                      e Zd ZdZdS )SecurityWarningz0Warned when performing security reducing actionsNr   r   r   r   r   r              ::::r   r   c                      e Zd ZdZdS )InsecureRequestWarningz/Warned when making an unverified HTTPS request.Nr   r   r   r   r   r      s        9999r   r   c                      e Zd ZdZdS )NotOpenSSLWarningz)Warned when using unsupported SSL libraryNr   r   r   r   r   r      s        3333r   r   c                      e Zd ZdZdS )SystemTimeWarningz0Warned when system time is suspected to be wrongNr   r   r   r   r   r      r   r   r   c                      e Zd ZdZdS )InsecurePlatformWarningzIWarned when certain TLS/SSL configuration is not available on a platform.Nr   r   r   r   r   r      s        SSSSr   r   c                      e Zd ZdZdS )DependencyWarningzc
    Warned when an attempt is made to import a module with missing optional
    dependencies.
    Nr   r   r   r   r   r                 r   r   c                      e Zd ZdZdS )ResponseNotChunkedz;Response needs to be chunked in order to read it as chunks.Nr   r   r   r   r   r      r?   r   r   c                      e Zd ZdZdS )BodyNotHttplibCompatiblez
    Body should be :class:`http.client.HTTPResponse` like
    (have an fp attribute which returns raw chunks) for read_chunked().
    Nr   r   r   r   r   r      r   r   r   c                  8    e Zd ZU dZded<   ded<   ddZdd	Zd
S )r   z
    Response length doesn't match expected Content-Length

    Subclass of :class:`http.client.IncompleteRead` to allow int value
    for ``partial`` to avoid creating large objects on streamed reads.
    intpartialexpectedr   r   c                "    || _         || _        d S r1   r   r   )r"   r   r   s      r   r!   zIncompleteRead.__init__  s     r   r   c                $    d| j         | j        fz  S )Nz/IncompleteRead(%i bytes read, %i more expected)r   r(   s    r   __repr__zIncompleteRead.__repr__  s    @LMD
 
 	
r   N)r   r   r   r   r   r   r   r   )r   r   r   r   r<   r!   r   r   r   r   r   r      s\           LLLMMM! ! ! !
 
 
 
 
 
r   r   c                  "    e Zd ZdZddZdd
ZdS )InvalidChunkLengthz+Invalid chunk length in a chunked response.responser	   lengthbytesr   r   c                l    |                                 | _        |j        | _        || _        || _        d S r1   )tellr   length_remainingr   r   r   )r"   r   r   s      r   r!   zInvalidChunkLength.__init__  s-    $MMOO$,$= r   r   c                $    d| j         | j        fz  S )Nz0InvalidChunkLength(got length %r, %i bytes read))r   r   r(   s    r   r   zInvalidChunkLength.__repr__  s    AKLE
 
 	
r   N)r   r	   r   r   r   r   r   )r   r   r   r   r!   r   r   r   r   r   r     sB        55   
 
 
 
 
 
r   r   c                      e Zd ZdZdS )InvalidHeaderz(The header provided was somehow invalid.Nr   r   r   r   r   r     s        2222r   r   c                  $     e Zd ZdZd fdZ xZS )ProxySchemeUnknownz1ProxyManager does not support the supplied schemerw   
str | Noner   r   c                p    |dk    rd }|d}nd| d}t                                          |           d S )N	localhostz>Proxy URL had no scheme, should start with http:// or https://z!Proxy URL had unsupported scheme z , should use http:// or https://rg   ry   s      r   r!   zProxySchemeUnknown.__init__&  sO     [  F>VGGb&bbbG!!!!!r   )rw   r   r   r   rH   r'   s   @r   r   r   !  sC        ;;	" 	" 	" 	" 	" 	" 	" 	" 	" 	"r   r   c                      e Zd ZdZdS )ProxySchemeUnsupportedz=Fetching HTTPS resources through HTTPS proxies is unsupportedNr   r   r   r   r   r   2  s        GGGGr   r   c                  $     e Zd ZdZd	 fdZ xZS )
HeaderParsingErrorzNRaised by assert_header_parsing, but we convert it to a log.warning statement.defectslist[MessageDefect]unparsed_databytes | str | Noner   r   c                \    |pd d|}t                                          |           d S )NUnknownz, unparsed data: rg   )r"   r   r   r   r#   s       r   r!   zHeaderParsingError.__init__9  s;     )	MMMMM!!!!!r   )r   r   r   r   r   r   rH   r'   s   @r   r   r   6  sC        XX" " " " " " " " " "r   r   c                      e Zd ZdZdS )UnrewindableBodyErrorz9urllib3 encountered an error when trying to rewind a bodyNr   r   r   r   r   r   @  r5   r   r   )A
__future__r   sockettypingr^   email.errorsr   http.clientr   httplib_IncompleteReadTYPE_CHECKING
connectionr   connectionpoolr   r   r	   
util.retryr
   r8   r   Warningr   TupleCallableobjectr%   r   r.   r4   r7   r>   rA   ConnectionErrorrC   rJ   rP   rR   rT   rV   rX   rc   ri   rl   rn   
ValueErrorrp   rr   rv   r{   r   r   r   r   r   r   r   r   r   r   AssertionErrorr   r   r   r   r   r   r   <module>r      s   " " " " " "    & & & & & & @ @ @ @ @ @	 "******......&&&&&&!!!!!!
. . . . .	 . . ., , , , ,' , , , l
OCK &,vs{";; 
	, 	, 	, 	, 	,	 	, 	, 	,	6 	6 	6 	6 	69 	6 	6 	6D D D D Dy D D D$ $ $ $ $ $ $ $F F F F F) F F FI I I I II I I I
  - - - - -L - - -*    |   < < < < <	 < < <    9   Q Q Q Q Q|\ Q Q QK K K K K, K K K    ,i   &( ( ( ( (, ( ( (N N N N NY N N NR R R R RI R R RN N N N Ni N N NG G G G GY G G G! ! ! ! !+ ! ! !    )   > > > > >I > > >; ; ; ; ;k ; ; ;: : : : :_ : : :4 4 4 4 4 4 4 4; ; ; ; ; ; ; ;T T T T To T T T       F F F F F
 F F F    y   
 
 
 
 
Y 6 
 
 
,
 
 
 
 
$: 
 
 
 3 3 3 3 3I 3 3 3" " " " ")9 " " ""H H H H HZ H H H" " " " " " " "D D D D DI D D D D Dr   