Python library for interacting with Axis device APIs
Project description
ax-devil-device-api
Python package and CLI for configuring Axis devices via their HTTPS APIs: device info and health, snapshots, network details, MQTT clients, analytics publishers, API discovery, SSH users and more.
See also ax-devil-mqtt and ax-devil-rtsp for related tools.
Install
pip install ax-devil-device-api
Configure (optional)
Set environment variables to avoid repeating credentials and broker details:
AX_DEVIL_TARGET_ADDR– Device IP or hostnameAX_DEVIL_TARGET_USER– Device usernameAX_DEVIL_TARGET_PASS– Device passwordAX_DEVIL_MQTT_BROKER_ADDR– MQTT broker addressAX_DEVIL_MQTT_BROKER_PASS– MQTT broker passwordAX_DEVIL_USAGE_CLI– Set tounsafeto allow--no-verify-sslwithout prompts (defaults tosafe)
Capabilities
- Device info & health – model/firmware, health, restart; CLI
device; Pythonclient.device - Network – interface details; CLI
network info; Pythonclient.network - Media – snapshots with resolution/compression; CLI
media snapshot; Pythonclient.media - MQTT client – configure/activate/deactivate/status/config; CLI
mqtt; Pythonclient.mqtt_client - Analytics MQTT publishers – list/create/remove; CLI
analytics; Pythonclient.analytics_mqtt - Analytics metadata producers – list/enable/disable/sample/versions; CLI
analytics-metadata; Pythonclient.analytics_metadata - API discovery – list APIs, inspect docs/models/openapi; CLI
discovery; Pythonclient.discovery - Feature flags – list/get/set; CLI
features; Pythonclient.feature_flags - Geocoordinates – location/orientation get/set/apply; CLI
geocoordinates; Pythonclient.geocoordinates - SSH users – add/list/show/modify/remove; CLI
ssh; Pythonclient.ssh - Debug – server/crash reports, network traces, pings, port checks, core dumps; CLI
debug; Pythonclient.device_debug
CLI
ax-devil-device-api --help lists all subcommands. Global options: --device-ip/-a, --device-username/-u, --device-password/-p, --protocol [http|https], --port, and --no-verify-ssl.
Common flows:
- Device checks and restart:
ax-devil-device-api device info \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password>
ax-devil-device-api device health
ax-devil-device-api device restart --force
- Capture a snapshot:
ax-devil-device-api media snapshot \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password> \
--resolution 1920x1080 \
--output snapshot.jpg
- Configure and inspect the device MQTT client:
ax-devil-device-api mqtt configure \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password> \
--broker-address <broker-ip> \
--broker-port 1883 \
--use-tls
ax-devil-device-api mqtt status
ax-devil-device-api mqtt config
- Network and geocoordinates:
ax-devil-device-api network info
ax-devil-device-api geocoordinates location set 59.3293 18.0686
ax-devil-device-api geocoordinates orientation set --heading 45 --tilt 5
ax-devil-device-api geocoordinates orientation apply
- Manage analytics publishers:
ax-devil-device-api analytics sources
ax-devil-device-api analytics create pub-1 "com.axis.analytics_scene_description.v0.beta#1" "axis/events" --qos 1 --retain
ax-devil-device-api analytics list
ax-devil-device-api analytics remove pub-1
- Manage analytics metadata producers:
ax-devil-device-api analytics-metadata list
ax-devil-device-api analytics-metadata enable metadata-producer --channel 1 --channel 2
ax-devil-device-api analytics-metadata sample metadata-producer --format json
- Feature flags:
ax-devil-device-api features list
ax-devil-device-api features get my_flag other_flag
ax-devil-device-api features set my_flag=true other_flag=false --force
- Inspect APIs exposed by the device:
ax-devil-device-api discovery list
ax-devil-device-api discovery info analytics-mqtt --docs-html-link
- Manage SSH users or collect diagnostics:
ax-devil-device-api ssh add new-user password123 --comment "Service account"
ax-devil-device-api ssh list
ax-devil-device-api ssh modify new-user --password new-pass
ax-devil-device-api debug download-server-report report.tar.gz
ax-devil-device-api debug download-crash-report crash.tar.gz
ax-devil-device-api debug ping-test example.com
Python API
import json
from ax_devil_device_api import Client, DeviceConfig
config = DeviceConfig.https(
host="192.168.1.81",
username="root",
password="pass",
verify_ssl=False, # leave True in production
)
with Client(config) as client:
info = client.device.get_info()
print(json.dumps(info, indent=2))
snapshot = client.media.get_snapshot(resolution="1280x720")
mqtt_state = client.mqtt_client.get_state()
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
Disclaimer
This project is an independent, community-driven implementation and is not affiliated with or endorsed by Axis Communications AB. For official APIs and development resources, see the Axis Developer Community.
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ax_devil_device_api-0.6.4.tar.gz.
File metadata
- Download URL: ax_devil_device_api-0.6.4.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1459811e3a7838c9c24722f7312b133e78ff74a9f6c5e26513acb3126870dd8b
|
|
| MD5 |
ad31715ce90ec27b7c2d5569549bdef0
|
|
| BLAKE2b-256 |
2338935c5ce3ec6d24514b00ebda11417d0b66eb2d807a78361ce34fec9911a3
|
File details
Details for the file ax_devil_device_api-0.6.4-py3-none-any.whl.
File metadata
- Download URL: ax_devil_device_api-0.6.4-py3-none-any.whl
- Upload date:
- Size: 56.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aed9c4ef0cc6972ee508665554e910e2bc37c5afbe2721d1fd655eec718e037
|
|
| MD5 |
0f3ccf775ab2334ef87fba23b1d9a30a
|
|
| BLAKE2b-256 |
6da9a9c6a8be98eeff8dbc7ee6b81d821634eff614e8f0c760a718e11f58a2a6
|