Skip to main content

Python library for interacting with Axis device APIs

Project description

ax-devil-device-api

Python 3.8+ License: MIT Type Hints

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ax_devil_device_api-0.3.4.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ax_devil_device_api-0.3.4-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file ax_devil_device_api-0.3.4.tar.gz.

File metadata

  • Download URL: ax_devil_device_api-0.3.4.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

Hashes for ax_devil_device_api-0.3.4.tar.gz
Algorithm Hash digest
SHA256 00814bed3728f7f32fd82ff117c8d0b3ba759eff7a8ff302ab57cd34e80da3da
MD5 6b03f681e3b4601329e77b153a52780c
BLAKE2b-256 5be188e77cc35251827bad7ea3d00e131346b90f6265b95e458b962df30397aa

See more details on using hashes here.

File details

Details for the file ax_devil_device_api-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for ax_devil_device_api-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 19f5bfd5a8e2e2e8f115af813051292c02f5558267ce7149ddeb117a53e0e2b2
MD5 6066c5829616d2bc3d80f56f826bf5f6
BLAKE2b-256 35e5585c337f9f2a6e7ab5e1b84789c41c4ebe6315c8d8462c1df1dc66a4c64f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page