Skip to content

Commit

Permalink
api regtok_details: Fix KeyError expiry_time
Browse files Browse the repository at this point in the history
as mentioned in PR #42
  • Loading branch information
JOJ0 committed Sep 21, 2021
1 parent 3241f25 commit 0efdd8b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions synadm/api.py
Expand Up @@ -718,7 +718,7 @@ def regtok_details(self, token, readable_expiry):

# Change expiry_time to a human readable format if requested
if readable_expiry and result is not None:
if result["expiry_time"] is not None:
if result.get("expiry_time") is not None:
result["expiry_time"] = self._datetime_from_timestamp(
result["expiry_time"]
).strftime("%Y-%m-%d %H:%M:%S")
Expand Down Expand Up @@ -808,7 +808,6 @@ def regtok_update(self, token, uses_allowed, expiry_ts, expire_at):

return self.query("put", f"v1/registration_tokens/{token}", data=data)


def regtok_delete(self, token):
""" Delete a registration token
Expand Down

0 comments on commit 0efdd8b

Please sign in to comment.