Newbie here attempting to read my meters via and ERT Gateway and Python script.
running ws/XbeeAttributeDataCore?condition=devConnectwareId=‘00000000-00000000-00409DFF-FF4AXXXX’ and xeProfileId = 265 and xeDeviceId=1281 and xaAttributeType=226 from the web services console return valid data.
I then export the python script and run from the command line
The following lines require manual changes
username = “xxxx” # enter your username
password = “xxxx” # enter your password
Nothing below this line should need to be changed
-------------------------------------------------
import httplib
import base64
create HTTP basic authentication string, this consists of
“username:password” base64 encoded
auth = base64.encodestring(“%s:%s”%(username,password))[:-1]
webservice = httplib.HTTP(“developer.idigi.com”,80)
to what URL to send the request with a given HTTP method
webservice.putrequest(“GET”, “ws/XbeeAttributeDataCore?condition=devConnectwareId=‘00000000-00000000-00409DFF-FF4Axxxx’ and xeProfileId = 265 and xeDeviceId=1281 and xaAttributeType=226”)
add the authorization string into the HTTP header
webservice.putheader(“Authorization”, “Basic %s”%auth)
webservice.putheader(“Content-type”, “text/xml; charset="UTF-8"”)
webservice.endheaders()
get the response
statuscode, statusmessage, header = webservice.getreply()
response_body = webservice.getfile().read()
print the output to standard out
print (statuscode, statusmessage)
print response_body
Is there something I am doing wrong?
Any help would be appreciated.