Skip to content

Commit

Permalink
simplify get_token
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthornton-lbl committed Nov 14, 2024
1 parent 792aab2 commit f96aa47
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nmdc_automation/api/nmdcapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ def get_token(self):
}
url = self._base_url + "token"
resp = requests.post(url, headers=h, data=data).json()
expt = resp["expires"]
self.expires = time() + expt["minutes"] * 60

self.token = resp["access_token"]
# Set token and default 1-day expiration (in seconds)
self.token = resp.get("access_token")
self.expires = time() + 86400 # 1 day = 86400 seconds

self.header = {
"accept": "application/json",
"Content-Type": "application/json",
Expand Down

0 comments on commit f96aa47

Please sign in to comment.