ghaberek / omada-api Goto Github PK
View Code? Open in Web Editor NEWA simple Python wrapper for the TP-Link Omada Software Controller API
License: MIT License
A simple Python wrapper for the TP-Link Omada Software Controller API
License: MIT License
Omada allows blocking and unblocking clients by mac address, which is useful for e.g. keeping kids off at certain times (at least until they become more tech-savvy and start spoofing your own address...)
This should also be exposed in this python package
I have an omada oc200 hardware controller (cloud based), will this work?
pip -r requirements.txt
python demo.py
LED turns off
Traceback (most recent call last):
File "/Users/main/dev/omada-api/demo.py", line 10, in <module>
omada.login()
File "/Users/main/dev/omada-api/omada/omada.py", line 242, in login
result = self.post( '/login', json={'username':username,'password':password} )
File "/Users/main/dev/omada-api/omada/omada.py", line 203, in post
response.raise_for_status()
File "/Users/main/dev/omada-api/.venv/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: for url: https://192.168.0.100:8043/api/v2/login?_=1673422789425
First of all thanks for the project.
Sadly the login fails for my Controller with firmware version 5.7.6. I get the following error message:
404 Client Error: for url: http://10.0.0.20:8088/{omadacId}/api/v2/login
getApiInfo() gives me API V3. Maybe they changed it. But changing apiPath to "/api/v3" didn´t work.
Any ideas? Thanks
The package should be able to extract client data from omada insights to give a full overview of currently and previously connected clients
As mentioned in #12, to say I maintain this project may be an overstatement. I am not disinterested in it but I also don't have a lot of free time to stay on top of things regularly. I will gladly add anyone as a contributor to this project if they want. I just ask that you've already submitted at least one PR and that you have one or more other Python projects on GitHub. Please reply here if you're interested.
I don't have a lot of specific intent or direction for this project but I would like to see a few things happen in time:
Hi. Any change you'd be willing to publish this to as a PyPI package?
When I try to run led.py or clients.py etc I get an error:
"File "led.py", line 1
SyntaxError: encoding problem: future_fstrings"
Hi,
After upgrading to latest controller firmware (OC200v1_un_1.14.2_20211215_rel61111_up), the Python wrapper does not work anymore:
Traceback (most recent call last):
File "/opt/omada-api/devices.py", line 83, in <module>
main()
File "/opt/omada-api/devices.py", line 70, in main
omada.login()
File "/opt/omada-api/omada/omada.py", line 242, in login
result = self.post( '/login', json={'username':username,'password':password} )
File "/opt/omada-api/omada/omada.py", line 203, in post
response.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
**requests.exceptions.HTTPError: 404 Client Error: for url: https://192.168.1.1:443/api/v2/login?_=1641554357608**
I just found this, and I was going to use it for a Home Assistant integration. Any chance you can or were planning to release it to PyPi eventually? That makes my life much easier if I can just add it to a manifest file.
Sorry, not sure how to raise a discussion here, vs. issue. This is not a bug! That's why I put Discussion in the title.
Just looking for the API information - perhaps provide a link, or better yet ... add the document to your source?
Thanks!
I'm trying to use wrapper with my Omada OC200 controller but I encounter an error and I'm not able to find any documentation on supported API.
This is my omada.cfg file:
[omada]
baseurl = https://192.168.0.154:443
site = Home
verify = False
username = sreggy
password = mypwd
and this is the error that I encounter with the running of client.py
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.0.154'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.0.154'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Traceback (most recent call last):
File "/Users/a020900/Downloads/omada-api-main/clients.py", line 113, in <module>
main()
File "/Users/a020900/Downloads/omada-api-main/clients.py", line 100, in main
clients = omada.getSiteClients()
File "/Users/a020900/Downloads/omada-api-main/omada/omada.py", line 303, in getSiteClients
return self.get_paged( f'/sites/{site}/clients', params={'filters.active':'true'} )
File "/Users/a020900/Downloads/omada-api-main/omada/omada.py", line 165, in get_paged
raise OmadaError(json)
omada.omada.OmadaError: errorCode=-1005, msg="Operation forbidden."
Hello. Is your code suitable for use on version 5.5.6?
When calling device.py I get the following
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib64/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "devices.py", line 83, in
main()
File "devices.py", line 70, in main
omada.login()
File "/home/local/Документы/omada-api-main/omada/omada.py", line 244, in login
self.currentUser = self.getCurrentUser()
File "/home/local/Документы/omada-api-main/omada/omada.py", line 263, in getCurrentUser
return self.get( '/users/current' )
File "/home/local/Документы/omada-api-main/omada/omada.py", line 163, in get
json = response.json()
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=1300,initial-scale=1,minimal-ui"/>
<link rel="shortcut icon" href="favicon.ico"/>
<link rel="stylesheet" href="theme/lib/css/jquery-8d5462339d.Jcrop.css">
<link rel="stylesheet" href="theme/lib/css/spectrum-db1edfecae.css">
<link rel="stylesheet" href="theme/css/su-3d58729bd2.css">
<title id="title">Omada Controller</title>
<noscript>
<meta http-equiv="refresh" content="0; url=error.html"/>
</noscript>
In addition to #8 it would be nice to have tags as well. This would enable distributions who want to run your tests to fetch the package from GitHub instead of PyPI.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.