Omada API
A simple Python wrapper for the TP-Link Omada Software Controller API.
Resources
Here are some links which may be helpful when using or extending this library:
- Omada SDN Controller V5.9.9 API Document
- Omada SDN Controller V5.4.6 API Document
- Omada SDN Controller V5.0.15 API Document
- Omada SDN Controller V4.1.5 API Document
- Requirements of Establishing an External Portal Server (> 5.0.15)
- Requirements of Establishing an External Portal Server (> 4.1.5)
- Requirements of Establishing an External Portal Server (> 2.6.0)
- Requirements of Establishing an External Portal Server (< 2.5.4)
Usage
Currently this is just the bare-minimum required to log in, get site settings, push site settings, and log out.
from omada import Omada
# load our local config file
omada = Omada('omada.cfg')
# or specify the baseurl and site name directly
#omada = Omada(baseurl='https://...', site='Office')
# log into the controller (username and password are in omada.cfg)
omada.login()
# or specify the username and password directly
# omada.login(username='apiuser', password='secretpassword')
# get the site settings
settings = omada.getSiteSettings()
# turn the LEDs off
settings['led']['enable'] = False
# push the settings back
omada.setSiteSettings(settings)
# log out of the controller
omada.logout()
Examples
led.py
I use this in a cron schedule to turn my site LED setting off at night and back on in the morning.
Turn the LED on:
$ python led.py on
led: on
Turn the LED off:
$ python led.py off
led: off
clients.py, devices.py
These are simple apps to display similar output to the "Clients" and "Devices" page on the web interface.
$ python clients.py
USERNAME IP ADDRESS STATUS
00-11-22-33-44-55 192.168.1.123 CONNECTED
...
Make sure you have your Settings file configured correctly for these to work.
Settings
You can store your controller settings in a configuration file to avoid hard-coding them in your scripts.
Currently supported settings:
baseurl- the base url to the controllersite- the name of the site in the controller (usuallyDefault)verify- set this toFalseto ignore self-signed certificate errorswarnings- set this toFalseto hide urllib3 warnings whenverify=Falseverbose- set this toTrueto force low-level reqeusts to output debugging infousername- the username to log in aspassword- the password for the user
Example
[omada]
baseurl = https://omadacontroller.local:8043
site = Default
verify = False
username = apiuser
password = secretpassword
Acknowledgements
For my wife, who asked that I turn off the device LEDs at night. :heart:
Metadata
Release files for omada-api 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| omada_api-0.1.3.tar.gz | 7.5 kB | Without provenance | Details for omada_api-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| omada_api-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for omada_api-0.1.3-py3-none-any.whl |
Total release size: 15.4 kB
Release files / omada_api-0.1.3.tar.gz
| Download URL | omada_api-0.1.3.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec4c9be604e6dc591595d8e3f78c0f559c06b042a08c8304e65c2bb3a551a627
|
|
BLAKE2b-256 checksum How to use checksums |
47612453ef6716bec40ded394b4d3a43e0dda20cdee6ec2f3117edab8163b2bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1040-azure
|
Release files / omada_api-0.1.3-py3-none-any.whl
| Download URL | omada_api-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a539c12b41559b14bb5b4af71987f03bc7972afde7b8eb0cd6e97f580c62838
|
|
BLAKE2b-256 checksum How to use checksums |
0e85921c58734add3b7d8e4468ceb556aeefabd9cca97deb054f21da1662c17a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1040-azure
|
Security for omada-api 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.