fail but retry if camera is gone
This commit is contained in:
parent
869fbfc4f9
commit
8f79d073e6
|
@ -126,12 +126,20 @@ class Camera:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get(self, method):
|
def get(self, method):
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
return requests.get(self.url(method), auth=self.auth).text
|
return requests.get(self.url(method), auth=self.auth).text
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
def put(self, method, data):
|
def put(self, method, data):
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
data = PTZData(data)
|
data = PTZData(data)
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
return requests.put(self.url(method), data=data, auth=self.auth).text
|
return requests.put(self.url(method), data=data, auth=self.auth).text
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
def momentary(self, cmd, duration=None):
|
def momentary(self, cmd, duration=None):
|
||||||
if duration:
|
if duration:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user