
    s<g$                    <   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j0                  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@y)W    )annotationsN)MessageDefect)IncompleteRead   )HTTPConnection)ConnectionPool)HTTPResponse)Retryc                      e Zd ZdZy)	HTTPErrorz#Base exception used by this module.N__name__
__module____qualname____doc__     P/home/kevstigneev/proxy/myenv/lib/python3.12/site-packages/urllib3/exceptions.pyr   r      s    -r   r   c                      e Zd ZdZy)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.c                <    || _         t        | 	  | d|        y Nz: )poolsuper__init__)selfr   message	__class__s      r   r   zPoolError.__init__"   "    	D6G9-.r   c                    | j                   dfS )N)NNr    r   s    r   
__reduce__zPoolError.__reduce__&   s    ~~|++r   )r   r   r   strreturnNoner'   _TYPE_REDUCE_RESULTr   r   r   r   r   r%   __classcell__r#   s   @r   r   r      s    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.c                4    || _         t        | 	  ||       y N)urlr   r   )r   r   r1   r   r    s       r   r   zRequestError.__init__.   s    w'r   c                8    | j                   d | j                  d ffS r0   )r    r1   r$   s    r   r%   zRequestError.__reduce__2   s    ~~dhh555r   )r   r   r1   r&   r   r&   r'   r(   r)   r+   r#   s   @r   r.   r.   +   s    B(6r   r.   c                      e Zd ZdZy)SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr   r   r   r   r4   r4   7       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_errorc                4    t         |   ||       || _        y r0   )r   r   r9   )r   r   errorr    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   ;   s    6 $ $r   r7   c                      e Zd ZdZy)DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr   r   r   r   r>   r>   F       Er   r>   c                      e Zd ZdZy)ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr   r   r   r   rA   rA   J   s    Hr   rA   c                  6     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`

    c                H    || _         d| d|d}t        | 	  |||       y )NzMax retries exceeded with url: z (Caused by ))reasonr   r   )r   r   r1   rF   r   r    s        r   r   zMaxRetryError.__init__`   s1     3C5VJaPsG,r   r0   )r   r   r1   r&   rF   zException | Noner'   r(   r   r   r   r   r   r,   r#   s   @r   rC   rC   U   s9     JN-"-),-6F-	- -r   rC   c                  6     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.c                @    d| }t         |   |||       || _        y )Nz'Tried to open a foreign host with url: )r   r   retries)r   r   r1   rK   r   r    s        r   r   zHostChangedError.__init__m   s)     <C5AsG,r   )   )r   r   r1   r&   rK   zRetry | intr'   r(   rG   r#   s   @r   rI   rI   j   s7    I FG"),7B	 r   rI   c                      e Zd ZdZy)TimeoutStateErrorz1Raised when passing an invalid state to a timeoutNr   r   r   r   rN   rN   u   s    ;r   rN   c                      e Zd ZdZy)TimeoutErrorzRaised when a socket timeout error occurs.

    Catching this error will catch both :exc:`ReadTimeoutErrors
    <ReadTimeoutError>` and :exc:`ConnectTimeoutErrors <ConnectTimeoutError>`.
    Nr   r   r   r   rP   rP   y   s    r   rP   c                      e Zd ZdZy)ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr   r   r   r   rR   rR      s    Pr   rR   c                      e Zd ZdZy)ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr   r   r   r   rT   rT      s    Jr   rT   c                  6     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.c                <    || _         t        | 	  | d|        y r   )connr   r   )r   rX   r   r    s      r   r   zNewConnectionError.__init__   r!   r   c                R    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DeprecationWarningrX   r$   s    r   r   zNewConnectionError.pool   s%    5		
 yyr   )rX   r   r   r&   r'   r(   )r'   r   )r   r   r   r   r   propertyr   r,   r#   s   @r   rV   rV      s    R/  r   rV   c                  $     e Zd ZdZd fdZ xZS )NameResolutionErrorz'Raised when host name resolution fails.c                8    d| d| d}t         |   ||       y )NzFailed to resolve 'z' (rE   r   r   )r   hostrX   rF   r   r    s        r   r   zNameResolutionError.__init__   s&    'vS:w'r   )rd   r&   rX   r   rF   zsocket.gaierrorrG   r#   s   @r   ra   ra      s    1( (r   ra   c                      e Zd ZdZy)EmptyPoolErrorzCRaised when a pool runs out of connections and no more are allowed.Nr   r   r   r   rf   rf          Mr   rf   c                      e Zd ZdZy)FullPoolErrorzGRaised when we try to add a connection to a full pool in blocking mode.Nr   r   r   r   ri   ri      s    Qr   ri   c                      e Zd ZdZy)ClosedPoolErrorzCRaised when a request enters a pool after the pool has been closed.Nr   r   r   r   rk   rk      rg   r   rk   c                      e Zd ZdZy)LocationValueErrorz<Raised when there is something wrong with a given URL input.Nr   r   r   r   rm   rm      s    Fr   rm   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.c                <    d| }t         |   |       || _        y )NzFailed to parse: )r   r   location)r   rq   r   r    s      r   r   zLocationParseError.__init__   s#    %hZ0! r   )rq   r&   r'   r(   rG   r#   s   @r   ro   ro      s    G! !r   ro   c                  $     e Zd ZdZd fdZ xZS )URLSchemeUnknownz2Raised when a URL input has an unsupported scheme.c                <    d| }t         |   |       || _        y )NzNot supported URL scheme )r   r   schemer   ru   r   r    s      r   r   zURLSchemeUnknown.__init__   s#    -fX6!r   )ru   r&   rG   r#   s   @r   rs   rs      s    < r   rs   c                      e Zd ZdZdZdZy)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   rx   rx      s    N.M=Nr   rx   c                      e Zd ZdZy)SecurityWarningz0Warned when performing security reducing actionsNr   r   r   r   r|   r|          :r   r|   c                      e Zd ZdZy)InsecureRequestWarningz/Warned when making an unverified HTTPS request.Nr   r   r   r   r   r      s    9r   r   c                      e Zd ZdZy)NotOpenSSLWarningz)Warned when using unsupported SSL libraryNr   r   r   r   r   r      s    3r   r   c                      e Zd ZdZy)SystemTimeWarningz0Warned when system time is suspected to be wrongNr   r   r   r   r   r      r}   r   r   c                      e Zd ZdZy)InsecurePlatformWarningzIWarned when certain TLS/SSL configuration is not available on a platform.Nr   r   r   r   r   r      s    Sr   r   c                      e Zd ZdZy)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y)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y)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                  6    e Zd ZU dZded<   ded<   ddZd	dZy)
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expectedc                     || _         || _        y r0   r   r   )r   r   r   s      r   r   zIncompleteRead.__init__  s     r   c                8    d| j                   | j                  fz  S )Nz/IncompleteRead(%i bytes read, %i more expected)r   r$   s    r   __repr__zIncompleteRead.__repr__  s#    @LLMMD
 
 	
r   N)r   r   r   r   r'   r(   r'   r&   )r   r   r   r   r<   r   r   r   r   r   r   r      s     LM!
r   r   c                       e Zd ZdZddZddZy)InvalidChunkLengthz+Invalid chunk length in a chunked response.c                l    |j                         | _        |j                  | _        || _        || _        y r0   )tellr   length_remainingr   responselength)r   r   r   s      r   r   zInvalidChunkLength.__init__  s*    $MMO$,$=$= r   c                8    d| j                   | j                  fz  S )Nz0InvalidChunkLength(got length %r, %i bytes read))r   r   r$   s    r   r   zInvalidChunkLength.__repr__  s#    AKKLLE
 
 	
r   N)r   r	   r   bytesr'   r(   r   )r   r   r   r   r   r   r   r   r   r   r     s    5
r   r   c                      e Zd ZdZy)InvalidHeaderz(The header provided was somehow invalid.Nr   r   r   r   r   r     s    2r   r   c                  $     e Zd ZdZd fdZ xZS )ProxySchemeUnknownz1ProxyManager does not support the supplied schemec                H    |dk(  rd }|d}nd| d}t         |   |       y )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://rc   rv   s      r   r   zProxySchemeUnknown.__init__&  s8     [ F>VG9&AabG!r   )ru   z
str | Noner'   r(   rG   r#   s   @r   r   r   !  s    ;	" 	"r   r   c                      e Zd ZdZy)ProxySchemeUnsupportedz=Fetching HTTPS resources through HTTPS proxies is unsupportedNr   r   r   r   r   r   2  s    Gr   r   c                  0     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.c                :    |xs d d|}t         |   |       y )NUnknownz, unparsed data: rc   )r   defectsunparsed_datar   r    s       r   r   zHeaderParsingError.__init__9  s*     )	**;M;LM!r   )r   zlist[MessageDefect]r   zbytes | str | Noner'   r(   rG   r#   s   @r   r   r   6  s(    X"*";M"	" "r   r   c                      e Zd ZdZy)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   rI   rN   rP   rR   rT   rV   ra   rf   ri   rk   
ValueErrorrm   ro   rs   rx   r|   r   r   r   r   r   r   r   r   r   AssertionErrorr   r   r   r   r   r   r   <module>r      s]   "    & @	*.&!
.	 .,' , ll
OOCK &,,vs{";; 
	,	 	,	69 	6Dy D$ $F) FII I
  -L -*| <	 <9 Q|\ QK, K,i &(, (NY NRI RNi NGY G!+ !) >I >;k ;:_ :4 4; ;To T F
 Fy 
Y 6 
,
$: 
 3I 3")9 ""HZ H" "DI Dr   