Skip to content

Commit

Permalink
deal with 429 errors better
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Sep 22, 2023
1 parent 4341dd1 commit b5f9007
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vwsfriend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
weconnect[Images]~=0.58.0
weconnect[Images]~=0.58.2
HAP-python[QRCode]~=4.7.1
pypng~=0.20220715.0
sqlalchemy~=2.0.19
Expand Down
7 changes: 7 additions & 0 deletions vwsfriend/vwsfriend/vwsfriend_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,13 @@ def mqttWorker():
sleeptime = args.interval - ((time.time() - starttime) % args.interval)
permanentErrors = 0
subsequentErrors = 0
except weconnect.TooManyRequestsError:
if subsequentErrors > 0:
LOG.error('Retrieval error during update. Too many requests from your account. Will try again after 15 minutes')
else:
LOG.warning('Retrieval error during update. Too many requests from your account. Will try again after 15 minutes')
sleeptime = 900
subsequentErrors += 1
except weconnect.RetrievalError:
if subsequentErrors > 0:
LOG.error('Retrieval error during update. Will try again after configured interval of %ds', args.interval)
Expand Down

0 comments on commit b5f9007

Please sign in to comment.