Skip to content

Commit

Permalink
simplified http request (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
infohash authored Nov 27, 2022
1 parent 083ac78 commit b3c93f5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/oic/oauth2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ def http_request(self, url: str, method="GET", **kwargs) -> requests.Response:
_kwargs = self.req_callback(method, url, **_kwargs)

try:
if getattr(self.settings, "requests_session", None) is not None:
r = cast(
requests.Response,
self.settings.requests_session.request(method, url, **_kwargs), # type: ignore
)
else:
r = requests.request(method, url, **_kwargs) # type: ignore
req = getattr(self.settings, "requests_session", None) or requests
r = cast(
requests.Response,
req.request(method, url, **_kwargs),
)
except Exception as err:
logger.error(
"http_request failed: %s, url: %s, htargs: %s, method: %s"
Expand Down

0 comments on commit b3c93f5

Please sign in to comment.