Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the key is still valid, don't generate it by click #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading