Python API client for GenieACS REST API
Project description
pygenieacs
A Python async API client for GenieACS — a TR-069 / CWMP Auto-Configuration Server.
This library provides a simple interface to interact with the GenieACS REST API asynchronously.
✨ Features
- List, inspect, and delete devices
- Run tasks (reboot, factory reset, firmware upgrade, etc.)
- Manage presets
- Manage provisions
- Fully async, Pythonic interface
📦 Installation
pip install pygenieacs
🚀 Usage Initialize Client
import asyncio
from pygenieacs import GenieACSClient, DevicesAPI, TasksAPI
async def main():
async with GenieACSClient(base_url="http://localhost:7557") as client:
devices = DevicesAPI(client)
tasks = TasksAPI(client)
# List devices
all_devices = await devices.list()
print(all_devices)
# Get a specific device
device_id = "001A2B3C4D"
info = await devices.get(device_id)
print(info)
# Reboot a device
await tasks.add(device_id, "reboot")
asyncio.run(main())
⚙️ Advanced
from pygenieacs import PresetsAPI
async def create_presets(client):
presets = PresetsAPI(client)
# Apply to all devices
await presets.create("daily-reboot", {
"weight": 0,
"precondition": "true",
"configurations": [
{"parameter": "InternetGatewayDevice.ManagementServer.PeriodicInformInterval", "value": "60"}
]
})
# Apply only to MikroTik devices
await presets.create("mikrotik-provision", {
"weight": 1,
"precondition": "DeviceId.Manufacturer == 'MikroTik'",
"configurations": [],
"provisions": ["default-config"],
})
# Apply firmware upgrade if version < 6.48
await presets.create("firmware-upgrade", {
"weight": 10,
"precondition": "Device.DeviceInfo.SoftwareVersion < '6.48'",
"configurations": [],
"provisions": ["upgrade-firmware"],
})
# Apply to devices with specific OUI
await presets.create("oui-target", {
"weight": 5,
"precondition": "DeviceId.OUI == '001A2B'",
"configurations": [
{
"parameter": "InternetGatewayDevice.LANDevice.1.LANHostConfigManagement.DHCPServerEnable",
"value": False
}
],
"provisions": [],
})
Provisions
from pygenieacs import ProvisionsAPI
async def create_provision(client):
provisions = ProvisionsAPI(client)
# Ensure Inform Interval is set and default Wi-Fi SSID exists
script = """
let interval = declare("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", {value: 1});
if (interval.value[0] != 300) {
declare("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", null, {value: 300});
}
let ssid = declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", {value: 1});
if (!ssid.value[0]) {
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", null, {value: "MyDefaultSSID"});
}
"""
await provisions.create("default-config", script)
🛠 Development Clone the repo and install locally:
git clone https://github.com/uberkie/pygenieacs.git
cd pygenieacs
pip install -e .
Run tests:
pytest
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 pygenieacs-0.1.2.tar.gz.
File metadata
- Download URL: pygenieacs-0.1.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
364275363180feefcaabad1ceea85db988208f22a4653c5928bcd68bcf1aebe6
|
|
| MD5 |
0c668856797087a4f0ec3a6e62e8efcf
|
|
| BLAKE2b-256 |
79a42b278f36164981817802480175d20c8be09c51df32a394d36ee6ed825faf
|
Provenance
The following attestation bundles were made for pygenieacs-0.1.2.tar.gz:
Publisher:
python-publish.yml on uberkie/pygenieacs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygenieacs-0.1.2.tar.gz -
Subject digest:
364275363180feefcaabad1ceea85db988208f22a4653c5928bcd68bcf1aebe6 - Sigstore transparency entry: 486768006
- Sigstore integration time:
-
Permalink:
uberkie/pygenieacs@564192661146c031f143c9d0826afb8778f0a0e6 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/uberkie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@564192661146c031f143c9d0826afb8778f0a0e6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygenieacs-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pygenieacs-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cc2a61a59d617eb792e73e7ac746e3899043f5445d2c46e296dd6ef5ada1791
|
|
| MD5 |
3b9223040a6577f76ee4ce9925797e36
|
|
| BLAKE2b-256 |
d0d03f9dce9bdf9308ce4c9c7e774f55a84ab323ddac42919c79e250477ca3b1
|
Provenance
The following attestation bundles were made for pygenieacs-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on uberkie/pygenieacs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygenieacs-0.1.2-py3-none-any.whl -
Subject digest:
0cc2a61a59d617eb792e73e7ac746e3899043f5445d2c46e296dd6ef5ada1791 - Sigstore transparency entry: 486768020
- Sigstore integration time:
-
Permalink:
uberkie/pygenieacs@564192661146c031f143c9d0826afb8778f0a0e6 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/uberkie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@564192661146c031f143c9d0826afb8778f0a0e6 -
Trigger Event:
release
-
Statement type: