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.


📋 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", "fusion", 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.2.tar.gz (32.6 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.2-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ax_devil_device_api-0.3.2.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for ax_devil_device_api-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c50e9e7d9f403e696de9f918a86f77652fd81ece1a6057298529da17617d3bc3
MD5 862f23ef2624c5d3b08e59d5f21bb695
BLAKE2b-256 cfbc06b0d33b752bcbcfe9c1a125746170ea4af13603d0608f94ac1a73a5adc1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ax_devil_device_api-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8fb41416838e4048f4f8ff28aa6a0c9d7136d948b81e34dbad73761df45a5187
MD5 d3c088d4a1aa1e1e6f0a33d9a5598f59
BLAKE2b-256 549cb736c51d48a199a1b4b602d6098c1351aca24b84535dbed87962b07231ba

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