Registry / http-networking / aiounifi

aiounifi

JSON →
library91pypypi✓ verified 84d ago

aiounifi is an asynchronous Python library for communicating with the UniFi Network Controller API. It provides a clean async interface for managing UniFi devices, clients, and settings. The current version is 90, requiring Python >=3.13.0, with active development and frequent releases.

pip install aiounifi
INSTALL
IMPORT
SIG · AIOUNIFI
A
aiounifi
http-networkingpythonv91
Install
4.6s avg
Import
719ms
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v55 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.762s · 28.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.676s · 31MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Controller
from aiounifi import Controller
from aiounifi.controller import Controller
Controller is exported from the top-level package since v45
Site
from aiounifi import Site
from aiounifi.models.site import Site
Site model class is available at top-level since v60

Connect to a UniFi controller and list sites.

import asyncio from aiounifi import Controller async def main(): controller = Controller( host="192.168.1.1", username="admin", password="password", port=8443, ssl_verify=False ) await controller.initialize() sites = await controller.get_sites() print(sites) await controller.close() asyncio.run(main())
Debug
Known issues
deprecatedThe method `controller.login()` is deprecated since v71; use `controller.initialize()` which automatically authenticates.
fix
Replace `await controller.login()` with `await controller.initialize()`.
affects: >=71
gotchaSSL verification is enabled by default (since v65). Many local controllers use self-signed certificates, causing SSL errors.
fix
Set `ssl_verify=False` in Controller constructor or provide a valid SSL context.
affects: >=65
breakingPython 3.12 support dropped; requires Python >=3.13 as of version 88.
fix
Upgrade Python to 3.13 or higher, or pin aiounifi to <88.
affects: >=88
gotchaThe `get_clients()` method returns a list of `Client` objects, not raw dicts (changed in v50).
fix
Access client attributes like `client.name` instead of `client['name']`.
affects: >=50
Errors
Common errors & fixes
aiounifi.exceptions.Unauthorized
Invalid credentials or session expired.
fix
Ensure username/password are correct and call `await controller.initialize()` to re-authenticate.
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.1:8443 ssl:default [getaddrinfo failed]
Wrong host or port, or network unreachable.
fix
Check controller IP and port; if using default HTTPS port (8443), ensure it's correct.
AttributeError: 'Controller' object has no attribute 'login'
Code uses deplicated `login()` method removed in newer versions.
fix
Use `controller.initialize()` instead of `controller.login()`.
Upgrade
Version history
91latest on PyPI · released May 25, 2026
Audit
Dependencies
aiohttprequiredAsync HTTP client for API requests
Agent activity
60 hits · last 30 days
node
54
OpenAI (training)
1
Resources