From 4a69917d90d242ed94c4a3742d96ede0b5d4df12 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 1 Apr 2024 15:14:22 +0200 Subject: [PATCH] Bump workflows --- .gitea/workflows/package.yml | 2 +- requests_util/__init__.py | 15 ++++++++------- requests_util/_version.py | 2 +- setup.py | 4 ++++ test/test_init.py | 3 +-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 371c878..47206aa 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -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: diff --git a/requests_util/__init__.py b/requests_util/__init__.py index e71891b..c771ea1 100644 --- a/requests_util/__init__.py +++ b/requests_util/__init__.py @@ -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() @@ -58,10 +59,10 @@ def initialize_session() -> requests.Session: def setup_limiter( - session: requests.Session, - url_prefix: str, - expire_after: datetime.datetime | None = None, - **limiter_args + session: requests.Session, + url_prefix: str, + expire_after: datetime.datetime | None = None, + **limiter_args, ) -> requests.Session: """ Initializes limiter on session for the given domain with the given diff --git a/requests_util/_version.py b/requests_util/_version.py index df9144c..10939f0 100644 --- a/requests_util/_version.py +++ b/requests_util/_version.py @@ -1 +1 @@ -__version__ = '0.1.1' +__version__ = '0.1.2' diff --git a/setup.py b/setup.py index bf5ae6d..71f0201 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,10 @@ with open(PACKAGE_NAME + '/_version.py') as f: del match, text +def read_requirements(path: str): + 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) diff --git a/test/test_init.py b/test/test_init.py index c89e235..b6c19d3 100644 --- a/test/test_init.py +++ b/test/test_init.py @@ -1,7 +1,6 @@ - import requests_util + def test_init(): session = requests_util.initialize_session() assert session is not None -