More robust when not configured
This commit is contained in:
parent
bd405b3d5a
commit
0545c9834f
|
@ -79,8 +79,9 @@ def setup_limiter(
|
||||||
|
|
||||||
Will always return the given session itself.
|
Will always return the given session itself.
|
||||||
"""
|
"""
|
||||||
if requests_ratelimiter:
|
if requests_ratelimiter and limiter_args:
|
||||||
session.mount(url_prefix, requests_ratelimiter.LimiterAdapter(**limiter_args))
|
session.mount(url_prefix, requests_ratelimiter.LimiterAdapter(**limiter_args))
|
||||||
if requests_cache and expire_after:
|
if requests_cache and expire_after:
|
||||||
session.settings.urls_expire_after[url_prefix] = expire_after
|
if settings := getattr(session, 'settings', None):
|
||||||
|
settings.urls_expire_after[url_prefix] = expire_after
|
||||||
return session
|
return session
|
||||||
|
|
Loading…
Reference in New Issue
Block a user