Python library for interacting with Axis device APIs
Project description
ax-devil-device-api
A Python library for interacting with Axis device APIs. Provides a type-safe interface with tools for device management, configuration, and integration.
See also: ax-devil-mqtt for using MQTT with an Axis device.
📋 Contents
🔍 Feature Overview
| Feature | Description | Python API | CLI Tool |
|---|---|---|---|
| 📱 Device Information | Get device details, check health status, and restart device | client.device |
ax-devil-device-api-device-info |
| 🔧 Device Debugging | Download server reports, crash reports, and run diagnostics | client.device_debug |
ax-devil-device-api-device-debug |
| 📷 Media Operations | Capture snapshots from device cameras | client.media |
ax-devil-device-api-media |
| 🔐 SSH Management | Add, list, modify, and remove SSH users | client.ssh |
ax-devil-device-api-ssh |
| 📡 MQTT Client | Configure, activate, deactivate, and check MQTT client status | client.mqtt_client |
ax-devil-device-api-mqtt-client |
| 📊 Analytics MQTT | Manage analytics data sources and publishers for MQTT | client.analytics_mqtt |
ax-devil-device-api-analytics-mqtt |
| 🔎 API Discovery | List and inspect available APIs on the device | client.discovery |
ax-devil-device-api-discovery |
| 🌍 Geocoordinates | Get and set device location and orientation | client.geocoordinates |
ax-devil-device-api-geocoordinates |
| 🚩 Feature Flags | List, get, and set device feature flags | client.feature_flags |
ax-devil-device-api-feature-flags |
| 🌐 Network | Get network interface information | client.network |
ax-devil-device-api-network |
🚀 Quick Start
Installation
pip install ax-devil-device-api
Environment Variables
For an easier experience, you can set the following environment variables:
export AX_DEVIL_TARGET_ADDR=<device-ip>
export AX_DEVIL_TARGET_USER=<username>
export AX_DEVIL_TARGET_PASS=<password>
export AX_DEVIL_USAGE_CLI="safe" # Set to "unsafe" to skip SSL certificate verification for CLI calls
💻 Usage Examples
Python API Usage
import json
from ax_devil_device_api import Client, DeviceConfig
# Initialize client (recommended way using context manager)
config = DeviceConfig.https("192.168.1.81", "root", "pass", verify_ssl=False)
with Client(config) as client:
device_info = client.device.get_info()
print(json.dumps(device_info, indent=4))
# Alternative: Manual resource management (not recommended)
client = Client(config)
try:
device_info = client.mqtt_client.get_state()
print(json.dumps(device_info, indent=4))
finally:
client.close() # Always close the client when done
CLI Usage Examples
📱 Device Information
# Get device information
ax-devil-device-api-device-info --device-ip 192.168.1.10 --username admin --password secret info
# Check device health
ax-devil-device-api-device-info --device-ip 192.168.1.10 --username admin --password secret health
# Restart device
ax-devil-device-api-device-info --device-ip 192.168.1.10 --username admin --password secret restart
🔧 Device Debugging
# Download server report
ax-devil-device-api-device-debug --device-ip 192.168.1.10 --username admin --password secret download_server_report report.tar.gz
# Download crash report
ax-devil-device-api-device-debug --device-ip 192.168.1.10 --username admin --password secret download_crash_report crash.tar.gz
📷 Media Operations
# Capture snapshot
ax-devil-device-api-media --device-ip 192.168.1.10 --username admin --password secret --output image.jpg snapshot
🔐 SSH Management
# List SSH users
ax-devil-device-api-ssh --device-ip 192.168.1.10 --username admin --password secret list
# Add SSH user
ax-devil-device-api-ssh --device-ip 192.168.1.10 --username admin --password secret add new-user password123
# Remove SSH user
ax-devil-device-api-ssh --device-ip 192.168.1.10 --username admin --password secret remove user123
📡 MQTT Client
# Activate MQTT client
ax-devil-device-api-mqtt-client --device-ip 192.168.1.10 --username admin --password secret activate
# Deactivate MQTT client
ax-devil-device-api-mqtt-client --device-ip 192.168.1.10 --username admin --password secret deactivate
📊 Analytics MQTT
# List available analytics data sources
ax-devil-device-api-analytics-mqtt --device-ip 192.168.1.10 --username admin --password secret sources
# List configured publishers
ax-devil-device-api-analytics-mqtt --device-ip 192.168.1.10 --username admin --password secret list
🔎 API Discovery
# List available APIs
ax-devil-device-api-discovery --device-ip 192.168.1.10 --username admin --password secret list
# Get API info
ax-devil-device-api-discovery --device-ip 192.168.1.10 --username admin --password secret info vapix
🌍 Geocoordinates
# Get current location coordinates
ax-devil-device-api-geocoordinates --device-ip 192.168.1.10 --username admin --password secret location get
# Set location coordinates
ax-devil-device-api-geocoordinates --device-ip 192.168.1.10 --username admin --password secret location set 59.3293 18.0686
🚩 Feature Flags
# List all feature flags
ax-devil-device-api-feature-flags --device-ip 192.168.1.10 --username admin --password secret list
# Set feature flags
ax-devil-device-api-feature-flags --device-ip 192.168.1.10 --username admin --password secret set feature_name=true
🌐 Network
# Get network interface information
ax-devil-device-api-network --device-ip 192.168.1.10 --username admin --password secret info
Note: For more CLI examples, check the examples directory in the source code.
⚠️ 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, please refer to Axis Developer Community.
📄 License
MIT License - See LICENSE file 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.4.0.tar.gz.
File metadata
- Download URL: ax_devil_device_api-0.4.0.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83b5383e31cefb27c6e4e8d92657b20267ee9220b958978d51636774248de341
|
|
| MD5 |
a4670d567945d3732495e4db7b1f2cf0
|
|
| BLAKE2b-256 |
202fe1430172a580432ce7481015ba792a994cba6c90668d5df94b409040f7f5
|
File details
Details for the file ax_devil_device_api-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ax_devil_device_api-0.4.0-py3-none-any.whl
- Upload date:
- Size: 45.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b751630e81b7ac876d65de7bdbabc514e0d850bf7e4cd71d4ad3e83d7ca81a22
|
|
| MD5 |
2fa5bd296fe428456b01564d0809cbf6
|
|
| BLAKE2b-256 |
881963c635fcf0cda3ee70270a259ef7e83e6112ea87613a02777682c645ec7e
|