Created
October 29, 2020 00:19
-
-
Save dwblair/8a40ed1663c0a6b374192dab44e289f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
baseurl='http://157.230.188.100:3000/api/drives/' | |
public_key='c5d1df56d250615bfd3cc547d3bb7313ea1304d280efdefb9f26b268414d141c' | |
private_key='e18cdb6163d36b3195d17eace02932eba57314809149975fd028053feca86c02' | |
url = baseurl+public_key | |
temp = 23 | |
humid = 31 | |
deviceId = "sensor1" | |
payload = {"deviceId":deviceId,"fields":{"temp":temp, "humid":humid}} | |
headers = { | |
'Authorization': '{}'.format(private_key), | |
'Content-Type': 'application/json' | |
} | |
response = requests.request("PUT", url, headers=headers, json = payload) | |
print(response.text.encode('utf8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment