From 12381c0eb65917f6fb98289fade403ea906f8418 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 26 Mar 2023 12:22:23 +0200 Subject: [PATCH] no token error --- rowers/integrations/strava.py | 6 +++--- rowers/integrations/trainingpeaks.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rowers/integrations/strava.py b/rowers/integrations/strava.py index 51059999..e6bf9713 100644 --- a/rowers/integrations/strava.py +++ b/rowers/integrations/strava.py @@ -207,7 +207,7 @@ class StravaIntegration(SyncIntegration): def get_workout(self, id, *args, **kwargs) -> int: try: _ = self.open() - except NoTokenError: + except NoTokenError("Strava error"): return 0 csvfilename = 'media/{code}_{id}.csv'.format( @@ -229,9 +229,9 @@ class StravaIntegration(SyncIntegration): limit_n = kwargs.get('limit_n',0) if (self.rower.stravatoken == '') or (self.rower.stravatoken is None): # pragma: no cover - raise NoTokenError + raise NoTokenError("Error") elif (self.rower.stravatokenexpirydate is None or timezone.now()+timedelta(seconds=3599) > self.rower.stravatokenexpirydate): # pragma: no cover - raise NoTokenError + raise NoTokenError("Error") # ready to fetch. Hurray authorizationstring = str('Bearer ' + self.rower.stravatoken) diff --git a/rowers/integrations/trainingpeaks.py b/rowers/integrations/trainingpeaks.py index 6280bbcc..14e3307a 100644 --- a/rowers/integrations/trainingpeaks.py +++ b/rowers/integrations/trainingpeaks.py @@ -121,7 +121,7 @@ class TPIntegration(SyncIntegration): ) if response.status_code != 200: - raise NoTokenError + raise NoTokenError("no token") try: token_json = response.json()