Aug-28-2018, 07:48 PM
(This post was last modified: Aug-28-2018, 07:49 PM by gontajones.)
Try to set up the headers.
import requests import json headers = {'Content-type': 'application/json'} data = {'structures_names': ["ENERGIE AGENCE - POST LU"], 'dates' : ["2018-07-06 06:06","2018-07-30 06:06"], 'IO_name' : ["temp bureau minerais 1 etage 3"], 'IO_type': ["TEMPERATURE"], 'period_length': ["year","month"]} data_json = json.dumps(data) url = 'http://www.ewattchcloud.fr/api/V1/struct?api_key=API_KEY_REMOVED' r = requests.post(url, data=data_json, headers=headers) print (r.status_code) print(r.json())