mkt.databases.requests_wrapper
Cached HTTP session wrapper (requests-cache) with retry handling.
Provides get_cached_session(), a cached requests_cache.CachedSession with
retry logic, used for all HTTP calls across the databases package.
Functions
|
Add retry logic to a session. |
Get a cached session. |
- mkt.databases.requests_wrapper.add_retry_to_session(session, retries=5, backoff_factor=0.3, status_forcelist=(429, 500, 501, 502, 503, 504))[source]
Add retry logic to a session.
- Parameters:
session (requests.Session) – Session object
retries (int) – Number of retries
backoff_factor (float) – Backoff factor
status_forcelist (tuple[int]) – Tuple of status codes to force a retry
- Returns:
Session object with retry logic
- Return type:
requests.Session