Start a new topic

curl to python for eventghost

i received my device today and i could not be happier, it's really amazing, and the display is really cool. Really way above my expectations, great job guys. 


i use a software called Eventghost to automate my house, great software. it's based on python. to make it short, i want to have an app where i can send info from eventghost to LaMetric. 


i need to convert the curl code to python, i have this so far. 

 

import requests

headers = {
'Accept': 'application/json',
'X-Access-Token': 'MY-TOKEN',
'Cache-Control': 'no-cache'
}

payload = {
    "frames": [
        {
            "index": 0,
            "text": "My Text Goes Here",
            "icon": "a87"
        }
    ]
}

requests.post('https://developer.lametric.com/api/V1/(API)', headers=headers, data=payload)


i'm not getting any errors in python but the device is not updating. If any one has any suggestions please let me know. 

it'll be great to be able to push any type of info

1 Comment

i had similar issues, due to https. Solvde using this:

  

req = urllib2.Request(mypath, data=json.dumps(posttext), headers=headers)
gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)  # Only for gangstars
info = urllib2.urlopen(req, context=gcontext).read()

 cheers 

Login or Signup to post a comment