From b9cef7ec63d419d6381ead9f5086ca52960934d3 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Wed, 5 Mar 2025 09:57:03 +0100 Subject: [PATCH] Do not attach limiter without any limiter args --- requests_util/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requests_util/__init__.py b/requests_util/__init__.py index a4a39ab..e1cf4fa 100644 --- a/requests_util/__init__.py +++ b/requests_util/__init__.py @@ -39,6 +39,7 @@ except ImportError: 'Library requests_ratelimiter could not be loaded. Automatic ratelimit configuration will not be used.', ) +__all__ = ['initialize_session', 'setup_limiter', '__version__'] CACHE_PATH_FROM_HOME = '.local/share/usagi-keiretsu/fin_data/http_cache' @@ -82,7 +83,7 @@ def setup_limiter( Will always return the given session itself. """ - if requests_ratelimiter and limiter_args: + if requests_ratelimiter and len(limiter_args) > 0: session.mount(url_prefix, requests_ratelimiter.LimiterAdapter(**limiter_args)) if requests_cache and expire_after: if settings := getattr(session, 'settings', None):