Python library for interacting with UniFi Site Manager API
Project description
UniFi Site Manager API Client
Python library for interacting with UniFi’s Site Manager Integration API. Tested on a selfhosted local instance only.
[!NOTE] This library was mainly creted to be used with NetAlertX, as such, full API coverage is not planned. PRs are however more than welcome.
📦 Usage
Navigate to Site Manager ⚙️ Settings -> Control Plane -> Integrations.
api_key: You can generate your API key under the Your API Keys section.base_url: You can find your base url in the API Request Format section.version: You can find your version as part of the url in the API Request Format section.
from unifi_sm_api.api import SiteManagerAPI
api = SiteManagerAPI(
api_key="fakeApiKey1234567890",
base_url="https://192.168.100.1/proxy/network/integration/",
version="v1",
verify_ssl=False
)
sites = api.get_sites()
for site in sites:
site_id = site["id"]
unifi_devices = api.get_unifi_devices(site_id=site_id)
clients = api.get_clients(site_id=site_id)
📘 Endpoints Covered
/sites— list available sites/sites/{site_id}/devices— list UniFi devices for a site/sites/{site_id}/clients— list connected clients
🔧 Requirements
- Python 3.8+
requestspytest(for running tests)- Local
.envfile with API credentials
Testing
🌍 Environment Setup
Create a .env file in the project root with the following:
API_KEY=fakeApiKey1234567890
BASE_URL=https://192.168.100.1/proxy/network/integration/
VERSION=v1
VERIFY_SSL=False
🧪 Running Tests
Make sure PYTHONPATH includes the project root, then run:
cd unifi-sm-api/tests
PYTHONPATH=.. pytest -s tests/test_api.py
💙 Donations
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
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 unifi_sm_api-0.2.1.tar.gz.
File metadata
- Download URL: unifi_sm_api-0.2.1.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b1b9d0ad30244cf93050f38e7208c0ed68407a788cf811acf206af2e12de1bc
|
|
| MD5 |
17d80547850222c28479d155d81c9ce9
|
|
| BLAKE2b-256 |
7cae340d531d82fda516514f8a05695f98bdf9cdfa801070562464ce00e8c02f
|
Provenance
The following attestation bundles were made for unifi_sm_api-0.2.1.tar.gz:
Publisher:
python-publish.yml on jokob-sk/unifi-sm-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_sm_api-0.2.1.tar.gz -
Subject digest:
4b1b9d0ad30244cf93050f38e7208c0ed68407a788cf811acf206af2e12de1bc - Sigstore transparency entry: 380016355
- Sigstore integration time:
-
Permalink:
jokob-sk/unifi-sm-api@7ba284a85ba2c81d2bf1de11784bc5edc9befeda -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/jokob-sk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7ba284a85ba2c81d2bf1de11784bc5edc9befeda -
Trigger Event:
release
-
Statement type:
File details
Details for the file unifi_sm_api-0.2.1-py3-none-any.whl.
File metadata
- Download URL: unifi_sm_api-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c45669140e125051c5af48f88e1fd504a1487f8ad3790b71d6e4bbdd59698d6
|
|
| MD5 |
c1e84a0fa74e3ddb28fef05ffb81b566
|
|
| BLAKE2b-256 |
a4bf0de2a29a9b867d1f0bf7d64815d0ace204f501487c56c0ded05984c85b0f
|
Provenance
The following attestation bundles were made for unifi_sm_api-0.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on jokob-sk/unifi-sm-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unifi_sm_api-0.2.1-py3-none-any.whl -
Subject digest:
5c45669140e125051c5af48f88e1fd504a1487f8ad3790b71d6e4bbdd59698d6 - Sigstore transparency entry: 380016372
- Sigstore integration time:
-
Permalink:
jokob-sk/unifi-sm-api@7ba284a85ba2c81d2bf1de11784bc5edc9befeda -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/jokob-sk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7ba284a85ba2c81d2bf1de11784bc5edc9befeda -
Trigger Event:
release
-
Statement type: