I've created a IBM Watson IoT platform, and a device type "testdevice".
I would like a simple test where I push data via a Python script and the HTTP API.
So far I've managed to be able to push data, but getting:
(403, 'Not allowed')
I can see in the IBM Watson IoT log that my computer has tried to push data, but Authentication failed
.
As a request header I'm using auth=('use-token-auth', 'MY-TOKEN')
so the entire code is:
import requests
response = requests.post('http://MY-ORG-ID.messaging.internetofthings.ibmcloud.com:1883/api/v0002/device/types/testdevice/devices/MY-DEVICE/events/test', data={'number': 1}, auth=('use-token-auth', 'MY-TOKEN'), headers={'Content-type': 'application/json'})
print(response.text) #TEXT/HTML
print(response.status_code, response.reason) #HTTP
What could be the reason for authentication failing?