
    Zh                     .   d dl mZ ddlm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 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e      Z G d( d)e      Z G d* d+e      Z G d, d-e      Z G d. d/e      Z G d0 d1e      Z G d2 d3e      Z  G d4 d5e      Z! G d6 d7e      Z" G d8 d9e      Z# G d: d;e      Z$ G d< d=ee      Z% G d> d?e      Z& G d@ dAee      Z G dB dCe      Z' G dD dEe(e      Z) G dF dGe      Z* G dH dIe      Z+yJ)K    )absolute_import   )IncompleteReadc                       e Zd ZdZy)	HTTPErrorz#Base exception used by this module.N__name__
__module____qualname____doc__     a/mounts/lovelace/software/anaconda3/envs/py312/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 Zd Zy)	PoolErrorz/Base exception for errors caused within a pool.c                 H    || _         t        j                  | |d|       y )Nz: )poolr   __init__)selfr   messages      r   r   zPoolError.__init__   s    	4T7!;<r   c                     | j                   dfS )N)NN	__class__r   s    r   
__reduce__zPoolError.__reduce__   s    ~~|++r   Nr	   r
   r   r   r   r   r   r   r   r   r      s    5=,r   r   c                       e Zd ZdZd Zd Zy)RequestErrorz8Base exception for PoolErrors that have associated URLs.c                 @    || _         t        j                  | ||       y N)urlr   r   )r   r   r#   r   s       r   r   zRequestError.__init__    s    4w/r   c                 8    | j                   d | j                  d ffS r"   )r   r#   r   s    r   r   zRequestError.__reduce__$   s    ~~dhh555r   Nr   r   r   r   r    r       s    >06r   r    c                       e Zd ZdZy)SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr   r   r   r   r&   r&   )       ?r   r&   c                   "     e Zd ZdZ fdZ xZS )
ProxyErrorz,Raised when the connection to a proxy fails.c                 >    t        t        | 
  ||g|  || _        y r"   )superr)   r   original_error)r   r   errorargsr   s       r   r   zProxyError.__init__1   s!    j$(%?$?#r   r	   r
   r   r   r   __classcell__r   s   @r   r)   r)   .   s    2$ $r   r)   c                       e Zd ZdZy)DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr   r   r   r   r2   r2   6       Ar   r2   c                       e Zd ZdZy)ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr   r   r   r   r5   r5   ;   s    Dr   r5   c                       e Zd ZdZddZy)MaxRetryErrora  Raised when the maximum number of retries is exceeded.

    :param pool: The connection pool
    :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool`
    :param string url: The requested Url
    :param exceptions.Exception reason: The underlying error

    Nc                 T    || _         d|d|d}t        j                  | |||       y )NzMax retries exceeded with url: z (Caused by ))reasonr    r   )r   r   r#   r:   r   s        r   r   zMaxRetryError.__init__Q   s'    HKVTdD#w7r   r"   r	   r
   r   r   r   r   r   r   r7   r7   G   s    8r   r7   c                       e Zd ZdZddZy)HostChangedErrorz?Raised when an existing pool gets a request for a foreign host.c                 L    d|z  }t         j                  | |||       || _        y )Nz)Tried to open a foreign host with url: %s)r    r   retries)r   r   r#   r?   r   s        r   r   zHostChangedError.__init__\   s'    =CdD#w7r   N)   r;   r   r   r   r=   r=   Y   s
    Er   r=   c                       e Zd ZdZy)TimeoutStateErrorz3 Raised when passing an invalid state to a timeout Nr   r   r   r   rB   rB   b   s    =r   rB   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   rD   rD   h   s     	r   rD   c                       e Zd ZdZy)ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr   r   r   r   rF   rF   r   s    Lr   rF   c                       e Zd ZdZy)ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr   r   r   r   rH   rH   y   s    Fr   rH   c                       e Zd ZdZy)NewConnectionErrorzHRaised when we fail to establish a new connection. Usually ECONNREFUSED.Nr   r   r   r   rJ   rJ   ~   s    Nr   rJ   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   rL   rL          Ir   rL   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   rO   rO      rM   r   rO   c                       e Zd ZdZy)LocationValueErrorz<Raised when there is something wrong with a given URL input.Nr   r   r   r   rQ   rQ      s    Br   rQ   c                       e Zd ZdZd Zy)LocationParseErrorz=Raised when get_host or similar fails to parse the URL input.c                 H    d|z  }t         j                  | |       || _        y )NzFailed to parse: %s)r   r   location)r   rU   r   s      r   r   zLocationParseError.__init__   s#    '(24) r   Nr;   r   r   r   rS   rS      s
    C!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   rW   rW      s    J.M=Nr   rW   c                       e Zd ZdZy)SecurityWarningz0Warned when performing security reducing actionsNr   r   r   r   r[   r[          6r   r[   c                       e Zd ZdZy)SubjectAltNameWarningzBWarned when connecting to a host with a certificate missing a SAN.Nr   r   r   r   r^   r^      s    H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    5r   r`   c                       e Zd ZdZy)SystemTimeWarningz0Warned when system time is suspected to be wrongNr   r   r   r   rb   rb      r\   r   rb   c                       e Zd ZdZy)InsecurePlatformWarningzEWarned when certain SSL configuration is not available on a platform.Nr   r   r   r   rd   rd      s    Kr   rd   c                       e Zd ZdZy)SNIMissingWarningz9Warned when making a HTTPS request without SNI available.Nr   r   r   r   rf   rf      r'   r   rf   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   rh   rh          
 	r   rh   c                       e Zd ZdZy) InvalidProxyConfigurationWarninga^  
    Warned when using an HTTPS proxy and an HTTPS URL. Currently
    urllib3 doesn't support HTTPS proxies and the proxy will be
    contacted via HTTP instead. This warning can be fixed by
    changing your HTTPS proxy URL into an HTTP proxy URL.

    If you encounter this warning read this:
    https://github.com/urllib3/urllib3/issues/1850
    Nr   r   r   r   rk   rk      s     	r   rk   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   rm   rm      r3   r   rm   c                       e Zd ZdZy)BodyNotHttplibCompatiblezz
    Body should be httplib.HTTPResponse like (have an fp attribute which
    returns raw chunks) for read_chunked().
    Nr   r   r   r   ro   ro      ri   r   ro   c                   (     e Zd ZdZ fdZd Z xZS )r   z
    Response length doesn't match expected Content-Length

    Subclass of http_client.IncompleteRead to allow int value
    for `partial` to avoid creating large objects on streamed
    reads.
    c                 .    t         t        |   ||       y r"   )r+   r   r   )r   partialexpectedr   s      r   r   zIncompleteRead.__init__   s    nd,Wh?r   c                 8    d| j                   | j                  fz  S )Nz/IncompleteRead(%i bytes read, %i more expected))rr   rs   r   s    r   __repr__zIncompleteRead.__repr__   s#    @LLMMD
 
 	
r   )r	   r
   r   r   r   ru   r0   r   s   @r   r   r      s    @
r   r   c                       e Zd ZdZy)InvalidHeaderz(The header provided was somehow invalid.Nr   r   r   r   rw   rw      s    .r   rw   c                   "     e Zd ZdZ fdZ xZS )ProxySchemeUnknownz1ProxyManager does not support the supplied schemec                 6    d|z  }t         t        |   |       y )NzNot supported proxy scheme %s)r+   ry   r   )r   schemer   r   s      r   r   zProxySchemeUnknown.__init__  s    1F: $09r   r/   r   s   @r   ry   ry      s    7: :r   ry   c                   "     e Zd ZdZ fdZ xZS )HeaderParsingErrorzNRaised by assert_header_parsing, but we convert it to a log.warning statement.c                 B    |xs dd|}t         t        |   |       y )NUnknownz, unparsed data: )r+   r}   r   )r   defectsunparsed_datar   r   s       r   r   zHeaderParsingError.__init__	  s%    -4-A	-A=Q $09r   r/   r   s   @r   r}   r}     s    T: :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     r'   r   r   N),
__future__r   packages.six.moves.http_clientr   httplib_IncompleteRead	Exceptionr   Warningr   r   r    r&   r)   r2   r5   ConnectionErrorr7   r=   rB   rD   rF   rH   rJ   rL   rO   
ValueErrorrQ   rS   rW   r[   r^   r`   rb   rd   rf   rh   rk   rm   ro   rw   AssertionErrorry   r}   r   r   r   r   <module>r      s   & T
		 	
	' 	
	,	 	,	69 	6	y 	
$ $	) 	
	I 	  8L 8$| 		 		9 		|\ 		, 	
	,i 	
	Y 	
	i 	
	Y 	
!+ !>I >	k 	
	O 	
	_ 	
	 	
	o 	
	 	
	 		{ 		
 	
	y 	
Y 6 
&	I 	
: :: :	I 	r   