Skip to content

Commit

Permalink
[API] Handle imink API being down
Browse files Browse the repository at this point in the history
  • Loading branch information
HotaruBlaze committed May 10, 2024
1 parent f6e683f commit e5109a6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions client/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,20 @@ def __init__(self, userInfo, userLang, accessToken, guid):
self.na_id = userInfo['id']

self.imink = imink(self.na_id, self.accessToken, self.timestamp, self.guid, 1).get()
self.timestamp = int(self.imink['timestamp'])
self.guid = self.imink['request_id']

self.account = None
if 'error' in self.imink or self.imink.get('error') is not None:
iminkApiError = (
'Unable to authenticate with imink. \n\n'
'The F Calculation API may be experiencing issues. \n'
'Please check the website for more details: \n'
'https://status.imink.app/ \n'
)
raise RuntimeError(iminkApiError) from None
else:
self.timestamp = int(self.imink['timestamp'])
self.guid = self.imink['request_id']

self.account = None

def loginToAccount(self):
route = '/v3/Account/Login'
Expand Down

0 comments on commit e5109a6

Please sign in to comment.