Skip to content

Commit

Permalink
withings plugin: catch auth error
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Oct 31, 2023
1 parent af0722a commit 7b9eb37
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions withings_health/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ def _update(self):
userid=self._user_id,
client_id=self._client_id,
consumer_secret=self._consumer_secret)

self._client = WithingsApi(self._creds, refresh_cb=self._store_tokens)
try:
self._client = WithingsApi(self._creds, refresh_cb=self._store_tokens)
except Exception as e:
self.logger.error("Client can not be initialized.")
else:
self.logger.error(
"Token is expired, run OAuth2 again from Web Interface (Expiry Date: {}).".format(
Expand Down

0 comments on commit 7b9eb37

Please sign in to comment.