From 1f51a2ebb7471a565b8f97108a5bb380a15680c4 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Mon, 16 Oct 2023 15:14:16 +0000 Subject: [PATCH] If the key is still valid, don't generate it by click --- start.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/start.py b/start.py index 408b43b..7232b47 100644 --- a/start.py +++ b/start.py @@ -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"""""" - ) - 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"""""" + ) + 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"}