CR Token Error Handling

master
ToonsHub 2024-03-07 17:25:20 +01:00
parent 3ef71f84e8
commit 20d1d9cf62
1 changed files with 5 additions and 1 deletions

View File

@ -336,7 +336,11 @@ class CR(Service):
# Check for errors
if get_token.json().get('error'):
raise Exception(f"Error encountered while getting token: " + get_token.json()['error'])
if get_token.json()['error'] == "TOO_MANY_ACTIVE_STREAMS":
self.close_all_sessions()
return self.get_video_token(video_id)
else:
raise Exception(f"Error encountered while getting token: " + get_token.json()['error'])
# Get token from JSON response
token = get_token.json()['token']