Skip to content

Commit 2bfea10

Browse files
Merge pull request #58 from NYPL/noref-add-timeout
add timeout flag
2 parents fe99672 + 5a852d1 commit 2bfea10

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## v1.10.1 4/14/26
3+
- Add optional timeout param for OAuth2Client
4+
25
## v1.10.0 3/17/26
36
- Add Snowflake client
47
- Update config helper to allow loading config files without PLAINTEXT/ENCRYPTED structure

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "nypl_py_utils"
7-
version = "1.10.0"
7+
version = "1.10.1"
88
authors = [
99
{ name="Aaron Friedman", email="aaronfriedman@nypl.org" },
1010
]

src/nypl_py_utils/classes/oauth2_api_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class Oauth2ApiClient:
1616
"""
1717

1818
def __init__(self, client_id=None, client_secret=None, base_url=None,
19-
token_url=None, with_retries=False):
19+
token_url=None, with_retries=False, timeout_in_seconds=None):
20+
self.timeout_in_seconds = timeout_in_seconds
2021
self.client_id = client_id \
2122
or os.environ.get('NYPL_API_CLIENT_ID', None)
2223
self.client_secret = client_secret \
@@ -140,6 +141,7 @@ def _generate_access_token(self):
140141
"""
141142
self.logger.debug(f'Refreshing token via @{self.token_url}')
142143
self.oauth_client.fetch_token(
144+
timeout=self.timeout_in_seconds,
143145
token_url=self.token_url,
144146
client_id=self.client_id,
145147
client_secret=self.client_secret

0 commit comments

Comments
 (0)