1
0

Compare commits

..

No commits in common. "136d19d8134c22e8c64222d6e93ae16f4971fdfe" and "4a9a084bc50e25a6a816916c9cac503171442d92" have entirely different histories.

3 changed files with 9 additions and 20 deletions

View File

@ -1,8 +1,4 @@
<!--- WARNING ---!> # Requests utilities
<!--- THIS IS AN AUTO-GENERATED FILE ---!>
<!--- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN ---!>
# Requests utilities.
Utility for standarized usage of HTTP requests extension libraries in a modular fashion across different libraries. Utility for standarized usage of HTTP requests extension libraries in a modular fashion across different libraries.

View File

@ -1,18 +1,9 @@
"""# Requests utilities. """Utility module for setting up ratelimiting on third-party sessions."""
Utility for standarized usage of HTTP requests extension libraries in a modular fashion across different libraries.
Currently supports [`requests_cache`](https://requests-cache.readthedocs.io) and [`requests_ratelimiter`](https://github.com/JWCook/requests-ratelimiter).
The intention is that a libraries can automatically setup ratelimiting for
their specific use cases, as the library most likely has a better
understanding of the ratelimiting and caching behaviour of their associated websites than the user has.
"""
import datetime
import logging import logging
import os
import pathlib import pathlib
import os
import datetime
import requests import requests
@ -42,7 +33,8 @@ CACHE_PATH_FROM_HOME = '.local/share/usagi-keiretsu/fin_data/http_cache'
def initialize_session() -> requests.Session: def initialize_session() -> requests.Session:
"""Creates Session with or without caching depending upon current """
Creates Session with or without caching depending upon current
capabilities. capabilities.
""" """
logger.info('Setting up session') logger.info('Setting up session')
@ -72,7 +64,8 @@ def setup_limiter(
expire_after: datetime.datetime | None = None, expire_after: datetime.datetime | None = None,
**limiter_args, **limiter_args,
) -> requests.Session: ) -> requests.Session:
"""Initializes limiter on session for the given domain with the given """
Initializes limiter on session for the given domain with the given
settings. settings.
Will always return the given session itself. Will always return the given session itself.

View File

@ -1 +1 @@
__version__ = '0.1.11' __version__ = '0.1.10'