From 69a93e9f6da52a645986e071b3a9fb84e13bfed8 Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Tue, 14 Apr 2026 15:17:30 -0400 Subject: [PATCH 1/4] add timeout flag --- src/nypl_py_utils/classes/oauth2_api_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nypl_py_utils/classes/oauth2_api_client.py b/src/nypl_py_utils/classes/oauth2_api_client.py index 524ec3c..04129e0 100644 --- a/src/nypl_py_utils/classes/oauth2_api_client.py +++ b/src/nypl_py_utils/classes/oauth2_api_client.py @@ -16,7 +16,8 @@ class Oauth2ApiClient: """ def __init__(self, client_id=None, client_secret=None, base_url=None, - token_url=None, with_retries=False): + token_url=None, with_retries=False, timeoutInSeconds=None): + self.timeoutInSeconds = timeoutInSeconds self.client_id = client_id \ or os.environ.get('NYPL_API_CLIENT_ID', None) self.client_secret = client_secret \ @@ -140,6 +141,7 @@ def _generate_access_token(self): """ self.logger.debug(f'Refreshing token via @{self.token_url}') self.oauth_client.fetch_token( + timeout=self.timeoutInSeconds, token_url=self.token_url, client_id=self.client_id, client_secret=self.client_secret From d83264fc1222c2de05d4c966f9782a1bfeebcdd4 Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Tue, 14 Apr 2026 15:49:58 -0400 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a1c5ca..ae38c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## v1.10.1 4/14/26 +- Add optional timeout param for OAuth2Client + ## v1.10.0 3/17/26 - Add Snowflake client - Update config helper to allow loading config files without PLAINTEXT/ENCRYPTED structure From 18b4d7686fa28a701ee85b953ae53c353b7eb3ee Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Tue, 14 Apr 2026 15:56:43 -0400 Subject: [PATCH 3/4] update version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a84c3b4..c7007e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "nypl_py_utils" -version = "1.10.0" +version = "1.10.1" authors = [ { name="Aaron Friedman", email="aaronfriedman@nypl.org" }, ] From 5a852d18fbac749638e9f5a38c10bd324b427f0e Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Tue, 14 Apr 2026 16:07:09 -0400 Subject: [PATCH 4/4] casing --- src/nypl_py_utils/classes/oauth2_api_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nypl_py_utils/classes/oauth2_api_client.py b/src/nypl_py_utils/classes/oauth2_api_client.py index 04129e0..894b94d 100644 --- a/src/nypl_py_utils/classes/oauth2_api_client.py +++ b/src/nypl_py_utils/classes/oauth2_api_client.py @@ -16,8 +16,8 @@ class Oauth2ApiClient: """ def __init__(self, client_id=None, client_secret=None, base_url=None, - token_url=None, with_retries=False, timeoutInSeconds=None): - self.timeoutInSeconds = timeoutInSeconds + token_url=None, with_retries=False, timeout_in_seconds=None): + self.timeout_in_seconds = timeout_in_seconds self.client_id = client_id \ or os.environ.get('NYPL_API_CLIENT_ID', None) self.client_secret = client_secret \ @@ -141,7 +141,7 @@ def _generate_access_token(self): """ self.logger.debug(f'Refreshing token via @{self.token_url}') self.oauth_client.fetch_token( - timeout=self.timeoutInSeconds, + timeout=self.timeout_in_seconds, token_url=self.token_url, client_id=self.client_id, client_secret=self.client_secret