Giter VIP home page Giter VIP logo

omada-api's People

Contributors

f6f avatar gdepeyrot avatar ghaberek avatar jsestrich avatar sreggy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

omada-api's Issues

Block/Unblock functionality not exposed

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

Unable to login to Omada 5.7.4

Steps to reproduce:

  • clone repo
  • run pip -r requirements.txt
  • create omada.cfg (with proper credentials)
  • copy sample code to demo.py
  • python demo.py

Expected results:

LED turns off

Actual results:

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

Login fails for Omada 5.7.6

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

Project maintainers and future roadmap

Maintainers

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.

Roadmap

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:

  • Move existing comments to docstrings and add more/better info
  • Extend docstrings with references/notes from official TP-LINK docs
  • Generate documentation with Spinx or similar
  • Build data classes for each entity type to make data access easier
  • Refactor entity types into different modules (sites, clients, etc.)
  • Add more bounds/value checking where required (settings, etc.)
  • Condense most examples into a common CLI utility

Syntax Error for future-fstrings

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"

Stopped working with latest controller version

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**

Release to PyPi?

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.

Discussion: Omada API Information

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!

errorCode=-1005, msg="Operation forbidden."

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."

API doesn't show anything

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>
<script type="text/javascript" src="js/libs/polyfill-6926951583.min.js"></script> <script type="text/javascript" src="js/libs/g6-75b82cdd1d.min.js" async></script> <script type="text/javascript" src="js/libs/jquery-4cb8672160.min.js"></script> <script type="text/javascript" src="js/libs/jquery-16e37f8666.ui.min.js"></script> <script type="text/javascript" src="js/libs/sockjs-e2b1fc0be3.min.js"></script> <script type="text/javascript" src="js/libs/stomp-51779f8e6c.min.js"></script> <script type="text/javascript" src="js/libs/resize-observer-efda88a98d.min.js"></script> <script type="text/javascript" src="js/libs/spectrum-b2a4615880.min.js"></script> <script type="text/javascript" src="js/libs/jquery-29e923ff33.Jcrop.min.js"></script> <script type="text/javascript" src="js/libs/jquery-fc6a4a4eb5.cookie.min.js"></script> <script type="text/javascript" src="js/libs/perfect-scrollbar-85fff207d9.min.js"></script> <script type="text/javascript" src="js/libs/lottie-748e37b680.min.js"></script> <script type="text/javascript" src="js/libs/cryptoJS-242f7a6460.min.js"></script> <script type="text/javascript" src="js/libs/moment-761502841c.min.js"></script> <script type="text/javascript" src="js/libs/moment-timezone-with-data-5c8ed7bc8a.min.js"></script> <script type="text/javascript" src="js/libs/json2html-8826f30caf.min.js"></script> <script type="text/javascript" src="js/su/su-08cc8d9f61.js"></script> <script type="text/javascript"> $.su.language = new $.su.Language(); var canvas = document.getElementById("canvas-test"); try { canvas.getContext("2d"); document.body.removeChild(canvas); } catch (e) { location.href = "./error.html"; } var WebSocketsExist = !!window.WebSocket; if (!WebSocketsExist) { location.href = "./error.html"; } </script> <script type="text/javascript" src="js/su/service-b941b02bda.js"></script> <script type="text/javascript" src="js/su/data-26aadb7101.js"></script> <script type="text/javascript" src="js/su/widget-cf4f61ec0f.js"></script> <script type="text/javascript" src="js/su/form-55bf09c22e.js"></script> <script type="text/javascript" src="js/su/manager-0412ba783a.js"></script> <script type="text/javascript" src="js/su/dataBind-c7018623df.js"></script> <script type="text/javascript" src="js/su/application-cd135da3c4.js"></script> <script type="text/javascript" src="js/app/app-c44cff8888.js"></script> <script type="text/javascript"> $(document).ready(function(e){ App = new $.su.App(); App.setContainer("main-container"); App.init().done(function(){ App.launch(); }); }); </script> : 0

Tag the source

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.