Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
response_parsed = response.split("HD")[1][0]
exceptions = ["HX", "FS", "HD3.02", "H18"]
for camera in exceptions:
if camera in response:
exception_found = True
break
# HD4 (Hero4), HD5 (Hero5), HD6 (Hero6)... Exceptions: HX (HeroSession), FS (Fusion), HD3.02 (Hero+), H18 (Hero 2018)
if int(response_parsed) > 3 or exception_found:
print(jsondata["info"]["model_name"] +
"\n" + jsondata["info"]["firmware_version"])
self._prepare_gpcontrol()
self._camera = constants.Camera.Interface.GPControl
else:
response = self._request("camera/cv")
if b"Hero3" in response: # should detect HERO3/3+
self._camera = constants.Camera.Interface.Auth
except (HTTPError, URLError) as error:
try:
response = self._request("camera/cv")
if b"Hero3" in response: # should detect HERO3/3+
self._camera = constants.Camera.Interface.Auth
else:
self._prepare_gpcontrol()
except (HTTPError, URLError) as error:
self.power_on(self._mac_address)
time.sleep(5)
except timeout:
self.power_on(self._mac_address)
time.sleep(5)
except timeout:
self.power_on(self._mac_address)
time.sleep(5)
BU10_2="03"
BU30_1="04"
BU30_2="05"
BU30_3="06"
TIMELAPSE_RATE="TI"
class TimeLapseRate:
TIHalfSecond="00"
TI1Sec="01"
TI5Sec="05"
TI10Sec="0a"
TI30Sec="1e"
TI1Min="3c"
# used in examples
gpcontrol = Camera.Interface.GPControl
auth = Camera.Interface.Auth
def getStatusRaw(self):
"""Delivers raw status message"""
if self.whichCam() == constants.Camera.Interface.GPControl:
try:
req = self._request("gp/gpControl/status")
return req
except (HTTPError, URLError) as error:
return ""
except timeout:
return ""
elif self.whichCam() == constants.Camera.Interface.Auth:
try:
return self._request("camera/sx?t=" + self.getPassword())
except (HTTPError, URLError) as error:
return ""
except timeout:
return ""
else:
print("Error, camera not defined.")