cannot send data to Nova with Webhook


#1

When using the Dashboard, I can send a Hello World and with my code receive the message on the Raspi with a Nova.
But for the life of me, I cannot figure out how to do the exact same thing using the sample code provided in the documentation. I keep getting error: urllib2.HTTPError: HTTP Error 400, Bad Request

The url in the code below is exactly what I see in my Dashboard.
Can you please help?

from urllib2 import Request, urlopen
values = “”"
{
“data”: “Hello world!”,
“base64data”: “SGVsbG8gd29ybGQhCg==”
}
"""
headers = {
‘Content-Type’: ‘application/json’
}
request = Request(‘https://dashboard.hologram.io/api/1/devices/messages/[mydeviceid]/[myguid]’, data=values, headers=headers)
response_body = urlopen(request).read()
print (response_body)


#2

you have to send data or base64 encoded data not both. Try only sending one


#3

Thank you so much, I was just copying the documentation. It works!


#4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.