1
0

Compare commits

..

No commits in common. "19a6a9952f69ab4bcf712d69d3cf1a663c865988" and "1e5ad4a8b673fbeb0f147ff1bfa499d558fb065f" have entirely different histories.

7 changed files with 12 additions and 20 deletions

View File

@ -3,7 +3,7 @@ on: [push]
jobs: jobs:
Package: Package:
uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.03 uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.00
with: with:
PUBLISH: true PUBLISH: true
secrets: secrets:

View File

@ -31,12 +31,11 @@ except ImportError:
CACHE_PATH_FROM_HOME = '.local/share/usagi-keiretsu/fin_data/http_cache' 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')
# Setup cache if it can be loaded. # Setup cache if it can be loaded.
@ -49,7 +48,7 @@ def initialize_session() -> requests.Session:
expire_after=datetime.timedelta(days=1), expire_after=datetime.timedelta(days=1),
stale_if_error=True, stale_if_error=True,
cache_control=False, cache_control=False,
urls_expire_after={}, urls_expire_after = {},
) )
else: else:
session = requests.Session() session = requests.Session()
@ -59,10 +58,10 @@ def initialize_session() -> requests.Session:
def setup_limiter( def setup_limiter(
session: requests.Session, session: requests.Session,
url_prefix: str, url_prefix: str,
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

View File

@ -1 +1 @@
__version__ = '0.1.2' __version__ = '0.1.1'

View File

@ -1 +0,0 @@
requests

View File

@ -1 +0,0 @@
pytest

View File

@ -15,11 +15,6 @@ with open(PACKAGE_NAME + '/_version.py') as f:
del match, text del match, text
def read_requirements(path: str = 'requirements.txt'):
with open(path) as f:
return f.read().strip().split('\n')
def get_short_description(readme: str): def get_short_description(readme: str):
readme = re.sub(r'#+[^\n]*\n+', '', readme) readme = re.sub(r'#+[^\n]*\n+', '', readme)
m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme) m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme)
@ -40,10 +35,9 @@ setup(
author_email='jonjmaa@gmail.com', author_email='jonjmaa@gmail.com',
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
packages=[PACKAGE_NAME], packages=[PACKAGE_NAME],
install_requires=read_requirements(), install_requires=['requests'],
extras_require={ extras_require={
'Request ratelimiting': ['requests_ratelimiter'], 'Request ratelimiting': ['requests_ratelimiter'],
'Request caching': ['requests_cache'], 'Request caching': ['requests_cache'],
'test': read_requirements('requirements_test.txt'),
}, },
) )

View File

@ -1,6 +1,7 @@
import requests_util
import requests_util
def test_init(): def test_init():
session = requests_util.initialize_session() session = requests_util.initialize_session()
assert session is not None assert session is not None