Skip to content

Commit

Permalink
Add docstring to NmdcPortalApiClient._request method
Browse files Browse the repository at this point in the history
Co-authored-by: eecavanna <[email protected]>
  • Loading branch information
pkalita-lbl and eecavanna authored Jun 24, 2024
1 parent f23580c commit 3ad1619
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nmdc_runtime/site/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ class NmdcPortalApiClient:
access_token_expires_at: Optional[datetime] = None

def _request(self, method: str, endpoint: str, **kwargs):
r"""
Submits a request to the specified API endpoint;
after refreshing the access token, if necessary.
"""
if self.access_token is None or datetime.now() > self.access_token_expires_at:
refresh_response = requests.post(
f"{self.base_url}/auth/refresh",
Expand Down

0 comments on commit 3ad1619

Please sign in to comment.