Add retry for api state (handling random error)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
e9f0dd3f87
commit
de3c9d51b2
3
setup.py
3
setup.py
@ -5,7 +5,8 @@ setuptools.setup(
|
||||
'pyamaha @ git+https://github.com/nduhamel/pyamaha.git@citadel#egg=pyamaha',
|
||||
'citadel.mqtt @ git+https://git.quimbo.fr/citadel/mqtt.git@master#egg=citadel.mqtt',
|
||||
'systemd-python==234',
|
||||
'typer==0.3.2'
|
||||
'typer==0.3.2',
|
||||
'tenacity==8.0.1'
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -2,6 +2,8 @@ import logging
|
||||
import json
|
||||
|
||||
import requests
|
||||
from tenacity import retry, stop_after_attempt, wait_fixed
|
||||
|
||||
from pyamaha import Device, System, Zone
|
||||
|
||||
from citadel.mqtt import Client
|
||||
@ -39,6 +41,7 @@ class Yamaha:
|
||||
for action in senario.deactivate:
|
||||
self.request(action)
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_fixed(1), reraise=True)
|
||||
def request(self, request):
|
||||
try:
|
||||
r = self._device.request(request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user