Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from time import sleep
- import json
- import http.client, urllib.parse
- import re
- import requests
- while True:
- try:
- params = urllib.parse.urlencode({'uid': 1, 'temperature': 36.6})
- headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
- conn = http.client.HTTPConnection("137.117.173.220")
- conn.request("POST", "3000/sendSensorData", params, headers)
- response = conn.getresponse()
- print(response.status, response.reason)
- data = response.read()
- conn.close()
- except Exception as e:
- print("EXC", e)
- pass
- sleep(0.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement