https://github.com/rasmusrynell/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.
https://github.com/rasmusrynell/ax-devil-device-api
api ax-devil axis axis-communications axis-scene-description axis-scene-metadata camera cli device-apis library metadata python python3
Last synced: 12 months ago
JSON representation
A Python library for interacting with Axis device APIs. Provides a type-safe interface with tools for device management, configuration, and integration.
- Host: GitHub
- URL: https://github.com/rasmusrynell/ax-devil-device-api
- Owner: RasmusRynell
- License: mit
- Created: 2025-02-16T22:54:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-26T15:56:36.000Z (12 months ago)
- Last Synced: 2025-07-09T06:03:06.373Z (12 months ago)
- Topics: api, ax-devil, axis, axis-communications, axis-scene-description, axis-scene-metadata, camera, cli, device-apis, library, metadata, python, python3
- Language: Python
- Homepage:
- Size: 312 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ax-devil-device-api
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/dev/peps/pep-0484/)
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](https://github.com/rasmusrynell/ax-devil-mqtt) for using MQTT with an Axis device.
---
## 📋 Contents
- [Feature Overview](#-feature-overview)
- [Quick Start](#-quick-start)
- [Usage Examples](#-usage-examples)
- [Disclaimer](#-disclaimer)
- [License](#-license)
---
## 🔍 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
```bash
pip install ax-devil-device-api
```
### Environment Variables
For an easier experience, you can set the following environment variables:
```bash
export AX_DEVIL_TARGET_ADDR=
export AX_DEVIL_TARGET_USER=
export AX_DEVIL_TARGET_PASS=
export AX_DEVIL_USAGE_CLI="safe" # Set to "unsafe" to skip SSL certificate verification for CLI calls
```
---
## 💻 Usage Examples
### Python API Usage
```python
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
```bash
# 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
```
```bash
# 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
```
```bash
# Capture snapshot
ax-devil-device-api-media --device-ip 192.168.1.10 --username admin --password secret --output image.jpg snapshot
```
```bash
# 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
```
```bash
# 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
```
```bash
# 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
```
```bash
# 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
```
```bash
# 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
```
```bash
# 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
```
```bash
# 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](src/ax_devil_device_api/examples) 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](https://www.axis.com/en-us/developer).
## 📄 License
MIT License - See LICENSE file for details.