Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/nypl_py_utils/classes/oauth2_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be a curmudgeon but can we match variable name format i.e. timeout_in_seconds

self.timeoutInSeconds = timeoutInSeconds
self.client_id = client_id \
or os.environ.get('NYPL_API_CLIENT_ID', None)
self.client_secret = client_secret \
Expand Down Expand Up @@ -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
Expand Down
Loading