Add camera presets snapshots and continuous recording playback
This commit is contained in:
@@ -4,6 +4,7 @@ import datetime as dt
|
||||
import hashlib
|
||||
import secrets
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.sax.saxutils import escape
|
||||
@@ -39,8 +40,12 @@ def request(host, port, endpoint, namespace, operation, content, username, passw
|
||||
opener = urllib.request.build_opener(urllib.request.ProxyHandler({}), NoRedirect(), urllib.request.HTTPDigestAuthHandler(passwords))
|
||||
req = urllib.request.Request(target, data=envelope.encode(), headers={
|
||||
'Content-Type': 'application/soap+xml; charset=utf-8; action="' + namespace + '/' + operation + '"'})
|
||||
with opener.open(req, timeout=5) as response:
|
||||
root = ET.fromstring(response.read(1024 * 1024))
|
||||
try:
|
||||
with opener.open(req, timeout=5) as response:
|
||||
root = ET.fromstring(response.read(1024 * 1024))
|
||||
except urllib.error.HTTPError as exc:
|
||||
exc.close()
|
||||
raise
|
||||
if root.find('.//{http://www.w3.org/2003/05/soap-envelope}Fault') is not None:
|
||||
raise ValueError('ONVIF returned a fault; check device credentials and permissions')
|
||||
return root
|
||||
|
||||
Reference in New Issue
Block a user