Giter Club home page Giter Club logo

asusroutermonitor's People

Contributors

lmeulen 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

Watchers

 avatar  avatar  avatar  avatar

asusroutermonitor's Issues

Prevent crash when iterating get_clientlist

I have noticed that the app crashes intermittently when iterating over clnts['get_clientlist']. It seems like it's undefined sometimes.

I've made a fix for this that I can push in a feature-branch if you want.

Best / J

Stacktrace:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/jeth/.local/lib/python3.7/site-packages/flask_cors/extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/jeth/apps/asus-router-monitor-rest/app.py", line 45, in onlineClients
return ar.get_online_clients()
File "/home/jeth/apps/asus-router-monitor-rest/asus_router.py", line 262, in get_online_clients
for c in clnts['get_clientlist']:
KeyError: 'get_clientlist'

https wan

seems it works only via lan. It can be http or https. Script uses only http.
If you want to use external ip you will get message
"Only HTTPS is supported when accessing the web UI from WAN."
also there are different ports of 80.
Changing port is not a problem, but i dont know how to deal with certificates via python. So the script dosnt work

missing 'isOnline' keys

Hi,

First of all thanks for you code.
in line 257, you assumed that 'isOnline' is available. But in somecases it's missing.
if (len(c) == 17) and (clnts['get_clientlist'][c]['isOnline'] == '1'):

So, it is better to check if the key is present. then go for filtering:
if (len(c) == 17) and "isOnline" in clnts['get_clientlist'][c]:

BTW, I am no coder. just a hobbiest. There may be a better way to handle missing 'isOnline' key.

I will use your code to create a telegram bot and send a message if a new client is associated in network.

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.