Aug-29-2018, 08:17 AM
Thank you! i tried your code, I don't really know why, but i have something but not the complete information. and I think that the package is called simplejson? not json in python, right?
I actually found the solution yesterday! the code bellow is working for people who are interested:
I actually found the solution yesterday! the code bellow is working for people who are interested:
import requests #lien URL url = "http://www.address.com" #clé API apikey = {"api_key":"API_KEY_REMOVED"} def post(): """fonction pour la requete POST""" payload = "{\r\n\"structures_name\" : [\"structure\"],\r\n\r\n\"dates\" : [\"2018-08-21 06:06\",\"2018-08-22 06:06\"],\r\n\"IO_name\" : [\"capteur 1\"],\r\n\"IO_type\": [\"TEMPERATURE\"],\r\n\"period_length\": [\"month\",\"day\",\"hour\"]\r\n}" headers = { 'Content-Type': "application/json", 'Cache-Control': "no-cache", } response = requests.post(url, data=payload, headers=headers, params=apikey) print(response.text)Still, thank you for your answer!