Skip to content

Commit

Permalink
Updated to api 0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
octimot committed Feb 5, 2024
1 parent 2778899 commit 3b85599
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion storytoolkitai/core/storytoolkitai.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def check_api_key(self, api_key=None):

# if the api key is not empty
if self.api_key and self.api_key != '':
check_path = 'https://api.storytoolkit.ai/check_token?token={}'.format(self.api_key)
check_path = 'https://api.storytoolkit.ai/check_key?key={}'.format(self.api_key)

# check if the API key is valid using the API
try:
Expand All @@ -412,6 +412,11 @@ def check_api_key(self, api_key=None):
self.api_key_valid = True
return True

elif response.status_code == 200 and response.text == 'expired':
logger.debug('User API key is expired.')
self.api_key_valid = False
return False

else:
logger.debug('User API key is not valid.')
self.api_key_valid = False
Expand Down

0 comments on commit 3b85599

Please sign in to comment.