1
0

Compare commits

..

4 Commits

Author SHA1 Message Date
136d19d813 🤖 Bumped version to 0.1.11
Some checks failed
Package Python / Package (push) Failing after 21s
Test Python / Test (push) Failing after 22s
This commit was automatically generated by a script: https://gitfub.space/Jmaa/python-omni
2024-07-08 19:07:05 +02:00
dbfcc8e579 🤖 Repository layout updated to latest version
This commit was automatically generated by a script: https://gitfub.space/Jmaa/python-omni
2024-07-08 19:06:10 +02:00
c2b32c9ea2
Ruff check 2024-07-08 19:01:04 +02:00
4367d95745
Module Docstring 2024-07-08 19:00:47 +02:00
3 changed files with 21 additions and 10 deletions

View File

@ -1,4 +1,8 @@
# Requests utilities <!--- WARNING ---!>
<!--- 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,9 +1,18 @@
"""Utility module for setting up ratelimiting on third-party sessions.""" """# Requests utilities.
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 logging
import pathlib
import os
import datetime import datetime
import logging
import os
import pathlib
import requests import requests
@ -33,8 +42,7 @@ 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')
@ -64,8 +72,7 @@ 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.10' __version__ = '0.1.11'