Fix Uptime json error and add cpu temperature#6
Open
raydoom wants to merge 6 commits intolmeulen:masterfrom
Open
Fix Uptime json error and add cpu temperature#6raydoom wants to merge 6 commits intolmeulen:masterfrom
raydoom wants to merge 6 commits intolmeulen:masterfrom
Conversation
[root@rl8-18 asus]# python3.11 ShowRouterInfo.py
{
"uptime":"Mon, 13 May 2024 09:28:43 +0800(63921 secs since boot)"
}
Traceback (most recent call last):
File "/root/asus/ShowRouterInfo.py", line 5, in <module>
print("Uptime : " + str(ri.get_uptime()))
^^^^^^^^^^^^^^^
File "/root/asus/RouterInfo.py", line 75, in get_uptime
return json.loads('{' + '"since":"{}", "uptime":"{}"'.format(since, up) + '}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 12 (char 11)
Author
|
CPUTemp : {'cpu_temperature': '64.568'} |
Author
|
My device is ZenWiFi_XD4_Pro |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

[root@rl8-18 asus]# python3.11 ShowRouterInfo.py
{
"uptime":"Mon, 13 May 2024 09:44:45 +0800(64882 secs since boot)"
}
"Mon, 13 May 2024 09:44:45 +0800
64882
{"since":""Mon, 13 May 2024 09:44:45 +0800", "uptime":"64882"}
Traceback (most recent call last):
File "/root/asus/ShowRouterInfo.py", line 5, in
print("Uptime : " + str(ri.get_uptime()))
^^^^^^^^^^^^^^^
File "/root/asus/RouterInfo.py", line 78, in get_uptime
return json.loads('{' + '"since":"{}", "uptime":"{}"'.format(since, up) + '}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 12 (char 11)