Hello, I’m trying to post data for multiple sensors in a single sensebox at opensenssemap using a Python script, but I keep getting error messages like:
{code: MethodNotAllowed, message: POST is not allowed}
I’ve tried multiple variations, all without success. I am able to send one sensor’s data at a time, but of course, I run into an issue trying to send several values in quick succession. I’ve read the docs for „Post multiple new measurements“ but alas, I’m never able to get it to work.
I’m hoping it’s an easy fix, and if anyone has suggestions, I would be grateful to hear them.
Current testing code (with #### to hide actual tokens and sensor specifics):
import requests
import json
token = "8be8cf7#########################494be6f08e9a2bda6dfb54e51";
headers = {'Authorization' : token, 'content-type': 'application/json'};
data = [{"sensor":"658###################19", "value":"12"},
{"sensor":"658###################21", "value":"43"}]
url = 'https://api.opensensemap.org/boxes/65###################b18/';
response = requests.post(url=url, headers=headers, data=data);
print(response.json());