Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API in Python and Postman
#2
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())
Reply


Messages In This Thread
API in Python and Postman - by melo - Aug-28-2018, 08:38 AM
RE: API in Python and Postman - by gontajones - Aug-28-2018, 07:48 PM
RE: API in Python and Postman - by melo - Aug-29-2018, 08:17 AM
RE: API in Python and Postman - by gontajones - Aug-29-2018, 10:39 AM
RE: API in Python and Postman - by snippsat - Aug-29-2018, 12:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  upload image with generated code from Postman does not work magic7598 0 1,743 Nov-30-2019, 10:32 AM
Last Post: magic7598
  [split] API in Python and Postman fioranosnake 26 8,602 Nov-20-2019, 07:30 PM
Last Post: fioranosnake

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020