Guest
Login
Register
Home
Help
Search
Login
Register
more G-Labs products
This forum is soon going to be read-only.
Please join the new
HomeGenie community on Google+
HomeGenie Forum
General Category
Troubleshooting and Support
Reading log file
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Reading log file (Read 646 times)
February 03, 2016, 05:54:29 PM
Read 646 times
billbrazeal
Information
Newbie
Posts:
8
Reading log file
I am trying to read the recent entries in the HG Log file from a python program. I can submit the command
http://serverurl/api/HomeAutomation.HomeGenie/Logging/Recent.Last/
<mseconds> via the requests.get command and get a <Response [200]> result so the command seems to work. But I don't see how to access the actual log file results. How are those returned from this command?
I know there is data in the log because it is enabled and I can download it and see data in the logs.
Logged
February 03, 2016, 08:21:21 PM
Reply #1
bkenobi
Information
Global Moderator
Posts:
1525
Re: Reading log file
I tried this api call and got a blank page back so I can't help apparently.
Logged
https://github.com/bkenobi/HomeGenie_Apps
February 03, 2016, 09:24:06 PM
Reply #2
billbrazeal
Information
Newbie
Posts:
8
Re: Reading log file
The documentation says that the Recent.Last command should return a JSON array of events but when I try to access the results of the call with the code below I get the error "No JSON object could be decoded" which is consistent with the JSON documentation that says:
In case the JSON decoding fails, r.json raises an exception. For example, if the response gets a 204 (No Content), or if the response contains invalid JSON, attempting r.json raises ValueError: No JSON object could be decoded.
>>> import requests
>>> r = requests.get('
http://serverurl/api/HomeAutomation.HomeGenie/Logging/Recent.Last/
<mseconds>')
>>> r.json()
I am not that familiar with calling the commands and accessing the results so maybe I am missing something here. If anyone can point out what I might be missing I would be grateful. Or, if there is an error in the documentation it might be good to investigate that.
Thanks
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
HomeGenie Forum
General Category
Troubleshooting and Support
Reading log file