Help uploading multiple sensors' data

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());

Hi @openpablo,

you are posting your measurements to the wrong endpint. The endpoint for uploading multiple measurements in your case is: https://api.opensensemap.org/boxes/65###################b18/data. You are missing the /data at the end.

And I am not a Python expert but I guess you have to encode your data array in a different way. Wrap the JSON Arry in ‚…‘ (single qoutes) or use json.dumps(data) to pass the data to the request.post method.

Thank you so much. Adding /data and using json.dumps(data) worked perfectly on the first try.