egeldenhuys / bandwidth-monitor Goto Github PK
View Code? Open in Web Editor NEWScrape bandwidth statistics from TP-LINK TD-W8960N web interface
License: MIT License
Scrape bandwidth statistics from TP-LINK TD-W8960N web interface
License: MIT License
Total Down (MiB): 5 (36 KiB/s)
Total Up (MiB) : 1 (6 KiB/s)
Session (MiB) : D: -377 | U: -425
Graph total usage as well as bandwidth usage. Graph hourly, daily, weekly.
See Projects/JavaScript/Players Online and Projects/VB.NET/Run escape online players
Just don't implement the same flaws as in those projects!
Consider implementing this in the future network logger system. Can then compare the accuracy of the router web interface.
@07b5afacde7b9499fac3046e616b98a7de5ce82d
Traceback (most recent call last):
File "bandwidth-monitor.py", line 182, in <module>
r = session.post(url, data=data, allow_redirects=True, timeout=5)
File "bandwidth-monitor.py", line 49, in main
statsNew = getStatistics(s)
File "bandwidth-monitor.py", line 159, in getStatistics
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 497, in post
return self.request('POST', url, data=data, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 455, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 578, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 178, in resolve_redirects
allow_redirects=False,
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 558, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 394, in send
r.content
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 679, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 616, in generate
decode_content=True):
File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 225, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 174, in read
data = self._fp.read(amt)
File "/usr/lib/python2.7/httplib.py", line 549, in read
return self._read_chunked(amt)
File "/usr/lib/python2.7/httplib.py", line 591, in _read_chunked
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
socket.timeout: timed out
Currently errors when running on Python 3.5.1
Traceback (most recent call last):
File "bandwidth-monitor.py", line 198, in <module>
main()
File "bandwidth-monitor.py", line 44, in main
authenticate(username, password, s, hashed)
File "bandwidth-monitor.py", line 80, in authenticate
m.update(username)
TypeError: Unicode-objects must be encoded before hashing
Display the amount of data that has been transfered since the session started.
Total Down (MiB): 82 (348 KiB/s)
Total Up (MiB): 11 (14 KiB/s)
Total session: 12 MiB | 2 MiB
After a while the following occurs where the session becomes the same as the total.
Total Down (MiB): 2157 (4 KiB/s)
Total Up (MiB) : 158 (1 KiB/s)
Session (MiB) : D: 2157 | U: 158
Stops responding after the 4 time out errors:
Total Down (MiB): 157 (5 KiB/s)
Total Up (MiB) : 712 (1 KiB/s)
Session (MiB) : D: -2110 | U: 134
[ERROR] Request timed out while fetching statistics!
[ERROR] Request timed out while fetching statistics!
[ERROR] Request timed out while fetching statistics!
[ERROR] Request timed out while fetching statistics!
^CTraceback (most recent call last):
File "bandwidth-monitor.py", line 240, in <module>
main()
File "bandwidth-monitor.py", line 73, in main
time.sleep(timeDiff)
KeyboardInterrupt
We want to continue counting the session total even over overflow has occurred.
Total Down (MiB): 1069 (70 KiB/s)
Total Up (MiB) : 969 (3 KiB/s)
Session (MiB) : D: -2052 | U: 160
Session download should be ~ 5165 MiB if overflow has occurred at 4096 MiB
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.