Curl - pycurl vs browser
Posted: 03 Dec 2017 19:47
Hi,
I'm currently collecting information about z-wave devices via python and bash using pycurl and curl. Everything works fine and I get the correct response - convert it to json and everything is fine.
Only when I try to get the battery status - they all have as the last number 128 , it doesn't work via python or curl, but works fine entering the URL into a browser.
e.g.:
Using any browser
http://111.1111.111.111:8083/ZAutomatio ... ay_4-0-128 entered into the browser brings:
{"data":{"creationTime":1508670254,"creatorId":1,"customIcons":{},"deviceType":"battery","h":847214338,"hasHistory":false,"id":"ZWayVDev_zway_4-0-128","location":0,"metrics":{"probeTitle":"Battery","scaleTitle":"%","level":100,"icon":"battery","title":"Duwi Battery (#4)","isFailed":true,"modificationTime":1508870985,"lastLevel":100},"order":{"rooms":0,"elements":0,"dashboard":0},"permanently_hidden":false,"probeType":"","tags":[],"visibility":true,"updateTime":1512064133},"code":200,"message":"200 OK","error":null}
where entering on linux:
root@xxx:/mnt/c/Users/yyy# curl --include -u user:password "http://111.111.111.111:8083/ZAutomation ... ay_4-0-128"
HTTP/1.1 404 Not Found
Server: Mongoose/6.4
Content-Type: application/json; charset=utf-8
X-API-VERSION: 2.0.1
Date: Sun, 03 Dec 2017 16:41:12 GMT
Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length, Content-Range, Content-Type, ETag, X-API-VERSION, Date, Cache-Control, If-None-Match, Content-Language, Accept-Language, ZWAYSession
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Authorization
Connection: close
Content-Length: 103
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_4-0-128 doesn't exist"}
And it's the same 404-error in Python.
A positive result is completly browser independent - works on Chrome, Edge and Firefox.
And it ONLY effects the batteries, all other devices have no problems.
It's so straneg, does anyone have an idea???
thx in advance
fip
I'm currently collecting information about z-wave devices via python and bash using pycurl and curl. Everything works fine and I get the correct response - convert it to json and everything is fine.
Only when I try to get the battery status - they all have as the last number 128 , it doesn't work via python or curl, but works fine entering the URL into a browser.
e.g.:
Using any browser
http://111.1111.111.111:8083/ZAutomatio ... ay_4-0-128 entered into the browser brings:
{"data":{"creationTime":1508670254,"creatorId":1,"customIcons":{},"deviceType":"battery","h":847214338,"hasHistory":false,"id":"ZWayVDev_zway_4-0-128","location":0,"metrics":{"probeTitle":"Battery","scaleTitle":"%","level":100,"icon":"battery","title":"Duwi Battery (#4)","isFailed":true,"modificationTime":1508870985,"lastLevel":100},"order":{"rooms":0,"elements":0,"dashboard":0},"permanently_hidden":false,"probeType":"","tags":[],"visibility":true,"updateTime":1512064133},"code":200,"message":"200 OK","error":null}
where entering on linux:
root@xxx:/mnt/c/Users/yyy# curl --include -u user:password "http://111.111.111.111:8083/ZAutomation ... ay_4-0-128"
HTTP/1.1 404 Not Found
Server: Mongoose/6.4
Content-Type: application/json; charset=utf-8
X-API-VERSION: 2.0.1
Date: Sun, 03 Dec 2017 16:41:12 GMT
Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length, Content-Range, Content-Type, ETag, X-API-VERSION, Date, Cache-Control, If-None-Match, Content-Language, Accept-Language, ZWAYSession
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Authorization
Connection: close
Content-Length: 103
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_4-0-128 doesn't exist"}
And it's the same 404-error in Python.
A positive result is completly browser independent - works on Chrome, Edge and Firefox.
And it ONLY effects the batteries, all other devices have no problems.
It's so straneg, does anyone have an idea???
thx in advance
fip