Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix logging spacing #25

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Changes from all 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
5 changes: 2 additions & 3 deletions src/nypl_py_utils/classes/oauth2_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@ def get(self, request_path, **kwargs):
resp.message = 'Oauth2 Client: Bad response from OauthClient'
resp.status_code = 500
self.logger.warning(f'Get request using path {request_path} \
returned response text:\n{resp.text}')
returned response text:\n{resp.text}')
# if client has specified that we want to retry failed requests and
# we haven't hit max retries
if self.with_retries is True:
retries = kwargs.get('retries', 0) + 1
if retries < 3:
self.logger.warning(
f'Retrying get request due to empty response from\
Oauth2 Client using path: {request_path}. \
Retry #{retries}')
Oauth2 Client using path: {request_path}. Retry #{retries}')
sleep(pow(2, retries - 1))
kwargs['retries'] = retries
# try request again
Expand Down
Loading