Skip to content

Commit

Permalink
If the key is still valid, don't generate it by click
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Oct 16, 2023
1 parent a003f4a commit 1f51a2e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,21 @@ def __init__(self):
self.refresh_info()

def setup(self, _=None):
self.output.value = "Trying to get the keys..."
try:
keys = self.get_keys()
except InputNotProvidedError as exc:
self.output.value = (
f"""<div class="alert alert-danger" role="alert">{str(exc)}</div>"""
)
return
self.store_the_keys(*keys)
self.output.value = "The keys were updated 👍"
"""The callback for the setup button."""
# if the key is still valid, do not update it
if self.key_is_valid():
self.output.value = "The key is still valid 👍"
else:
self.output.value = "Trying to get the keys..."
try:
keys = self.get_keys()
except InputNotProvidedError as exc:
self.output.value = (
f"""<div class="alert alert-danger" role="alert">{str(exc)}</div>"""
)
return
self.store_the_keys(*keys)
self.output.value = "The keys were updated 👍"

def get_keys(self):
headers = {"Content-Type": "application/json", "Accept": "application/json"}
Expand Down

0 comments on commit 1f51a2e

Please sign in to comment.