1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
19a6a9952f
Requirements files
Some checks failed
Python Package / Package (push) Failing after 22s
2024-04-01 15:16:47 +02:00
4a69917d90
Bump workflows 2024-04-01 15:14:22 +02:00
7 changed files with 20 additions and 12 deletions

View File

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

View File

@ -31,11 +31,12 @@ except ImportError:
CACHE_PATH_FROM_HOME = '.local/share/usagi-keiretsu/fin_data/http_cache'
def initialize_session() -> requests.Session:
'''
"""
Creates Session with or without caching depending upon current
capabilities.
'''
"""
logger.info('Setting up session')
# Setup cache if it can be loaded.
@ -48,7 +49,7 @@ def initialize_session() -> requests.Session:
expire_after=datetime.timedelta(days=1),
stale_if_error=True,
cache_control=False,
urls_expire_after = {},
urls_expire_after={},
)
else:
session = requests.Session()
@ -61,7 +62,7 @@ def setup_limiter(
session: requests.Session,
url_prefix: str,
expire_after: datetime.datetime | None = None,
**limiter_args
**limiter_args,
) -> requests.Session:
"""
Initializes limiter on session for the given domain with the given

View File

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

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
requests

1
requirements_test.txt Normal file
View File

@ -0,0 +1 @@
pytest

View File

@ -15,6 +15,11 @@ with open(PACKAGE_NAME + '/_version.py') as f:
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):
readme = re.sub(r'#+[^\n]*\n+', '', readme)
m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme)
@ -35,9 +40,10 @@ setup(
author_email='jonjmaa@gmail.com',
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME,
packages=[PACKAGE_NAME],
install_requires=['requests'],
install_requires=read_requirements(),
extras_require={
'Request ratelimiting': ['requests_ratelimiter'],
'Request caching': ['requests_cache'],
'test': read_requirements('requirements_test.txt'),
},
)

View File

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