HomeGenie Forum
General Category => Troubleshooting and Support => Topic started by: billbrazeal on February 03, 2016, 05:54:29 PM
-
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/ (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.
-
I tried this api call and got a blank page back so I can't help apparently.
-
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/ (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