#!/usr/bin/python3
import requests
from requests.auth import HTTPDigestAuth
import re
# SYNTAX FOR SETTING OPTIONS
# http://<ip>/cgi-bin/configManager.cgi?action=setConfig&<paramName>=<paramValue>[&<paramName>=<paramValue>...]
# SHOW ALL VideoAnalyseRules IN BROWSER
# http://192.168.0.108/cgi-bin/configManager.cgi?action=getConfig&name=VideoAnalyseRule
# Enable a rule
#response = requests.get(
# 'http://192.168.0.108/cgi-bin/configManager.cgi',
# params={
# 'action': 'setConfig',
# 'VideoAnalyseRule[0][2].Enable': 'true',
# },
# auth=HTTPDigestAuth('admin', 'PASSWORD'),
# )
# Print all VideoAnalyseRules (IVS rules)
response = requests.get(
'http://192.168.0.108/cgi-bin/configManager.cgi',
params={
'action': 'getConfig',
'name': 'VideoAnalyseRule',
},
auth=HTTPDigestAuth('admin', 'PASSWORD'),
)
for line in response.text.splitlines():
if re.search('\.Name=', line):
print(line)