Skip to content

Commit 07eb89e

Browse files
committed
Merge branch 'qa' into production
2 parents 1587186 + 5b07f83 commit 07eb89e

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## v1.1.4 3/14/24
3+
- Fix bug with oauth2 requests after token refresh
4+
25
## v1.1.3 11/9/23
36
- Finalize retry logic in Oauth2 Client
47

@@ -12,7 +15,7 @@
1215
> Host: ilsstaff.nypl.org
1316
> User-Agent: curl/7.64.1
1417
> Accept: */*
15-
>
18+
>
1619
```
1720
- Due to an accidental deployment, v1.1.0 and v1.1.1 were both released but are identical
1821

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.1.3"
7+
version = "1.1.4"
88
authors = [
99
{ name="Aaron Friedman", email="aaronfriedman@nypl.org" },
1010
]

src/nypl_py_utils/classes/oauth2_api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _do_http_method(self, method, request_path, **kwargs):
117117
from None
118118

119119
self._generate_access_token()
120-
return self._do_http_method(method, request_path, **kwargs).json()
120+
return self._do_http_method(method, request_path, **kwargs)
121121

122122
def _create_oauth_client(self):
123123
"""

tests/test_oauth2_api_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import pytest
55
from requests_oauthlib import OAuth2Session
6-
from requests import HTTPError, JSONDecodeError
6+
from requests import HTTPError, JSONDecodeError, Response
77

88
from nypl_py_utils.classes.oauth2_api_client import (Oauth2ApiClient,
99
Oauth2ApiClientError)
@@ -120,7 +120,10 @@ def test_token_expiration(self, requests_mock, test_instance,
120120
.post(TOKEN_URL, text=json.dumps(second_token_response))
121121

122122
# Perform second request:
123-
test_instance._do_http_method('GET', 'foo')
123+
response = test_instance._do_http_method('GET', 'foo')
124+
# Ensure we still return a plain requests Response object
125+
assert isinstance(response, Response)
126+
assert response.json() == {"foo": "bar"}
124127
# Expect a call on the second token server:
125128
assert len(second_token_server_post.request_history) == 1
126129
# Expect the second GET request to carry the new Bearer token:

0 commit comments

Comments
 (0)