
    K:gI
                         d dl mZmZmZmZmZ d dlmZ d dlm	Z	 d dl
mZ dZdZdZeeedd	d
eedf   deeef   dedeee      dedefdZ G d de      ZddgZy)    )Any
CollectionOptionalTupleUnion)Session)HTTPAdapterRetry)i  g?   N)status_forcelistbackoff_factortotalallowed_methodsr   .r   r   r   kwargsreturnc                 "    t        d||| |d|S )a  
    Create a `Retry <https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry>`_
    instance with adjustable default values. :class:`~pyairtable.Api` accepts this via the
    ``retry_strategy=`` parameter.

    For example, to increase the total number of retries:

        >>> from pyairtable import Api, retry_strategy
        >>> api = Api('auth_token', retry_strategy=retry_strategy(total=10))

    Or to retry certain types of server errors in addition to rate limiting errors:

        >>> from pyairtable import Api, retry_strategy
        >>> retry = retry_strategy(status_forcelist=(429, 500, 502, 503, 504))
        >>> api = Api('auth_token', retry_strategy=retry)

    You can also disable retries entirely:

        >>> from pyairtable import Api
        >>> api = Api('auth_token', retry_strategy=None)

    .. versionadded:: 1.4.0

    Args:
        status_forcelist: Status codes which should be retried.
        allowed_methods: HTTP methods which can be retried.
            If ``None``, then all HTTP methods will be retried.
        backoff_factor:
            A backoff factor to apply between attempts after the second try.
            Sleep time between each request will be calculated as
            ``backoff_factor * (2 ** (retry_count - 1))``
        total:
            Maximum number of retries. Note that ``0`` means no retries,
            whereas ``1`` will execute a total of two requests (original + 1 retry).
        **kwargs: Accepts any valid parameter to `Retry`_.
    )r   r   r   r    r
   )r   r   r   r   r   s        T/var/www/html/lionshead/venv/lib/python3.12/site-packages/pyairtable/api/retrying.pyretry_strategyr      s-    X  %)'	
      c                   $     e Zd Zdef fdZ xZS )_RetryingSessionr   c                     t         |           t        |      }| j                  d|       | j                  d|       y )N)max_retrieszhttps://zhttp://)super__init__r	   mount)selfr   adapter	__class__s      r   r   z_RetryingSession.__init__B   s4    .9

:w'

9g&r   )__name__
__module____qualname__r   r   __classcell__)r!   s   @r   r   r   A   s    'u ' 'r   r   r   r   )typingr   r   r   r   r   requestsr   requests.adaptersr	   urllib3.util.retryr   DEFAULT_RETRIABLE_STATUS_CODESDEFAULT_BACKOFF_FACTORDEFAULT_MAX_RETRIESintfloatstrr   r   __all__r   r   r   <module>r1      s    : :  ) $!'   
 )G(>$152CHo2 #u*%2 	2
 jo.2 2 2j'w ' r   