View Event list #78
-
How would I view the current camera event list and values through VAPIX? I want to check if a specific event has a data instance with the value 'true'. To edit this question, I am sending an HTTP SOAP request to obtain the list of events using the following Python code with IP, username, and password replaced. I get a Response 400, anyone what am I doing wrong?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @geiche735! Create the following files in a directory. requirements.txt
soap-get-event-instances.py import requests
import sys
if len(sys.argv) != 4:
print("Usage: soap-get-event-instances.py <ip> <username> <password>")
sys.exit(1)
ip = sys.argv[1]
username = sys.argv[2]
password = sys.argv[3]
url = "http://{}/vapix/services".format(ip)
auth = requests.auth.HTTPDigestAuth(username, password)
headers = {"Content-Type": "application/soap+xml; action=//www.axis.com/vapix/ws/event1/GetEventInstances; Charset=UTF-8"}
body = """
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope">
<SOAP-ENV:Body>
<m:GetEventInstances xmlns:m="http://www.axis.com/vapix/ws/event1"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>"""
r = requests.post(url, auth=auth, headers=headers, data=body)
print(r.status_code)
print(r.text) Then create and activate a new virtual environment: python3 -m venv env
source env/bin/activate Proceed with installing the required packages: pip install -r requirements.txt Then finally run the example with the following command: python3 soap-get-event-instances.py <ip> <username> <password> where |
Beta Was this translation helpful? Give feedback.
Hi @geiche735!
Create the following files in a directory.
requirements.txt
soap-get-event-instances.py