forked from gw0/BajtaHack2017-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpclient.py
More file actions
25 lines (23 loc) · 724 Bytes
/
httpclient.py
File metadata and controls
25 lines (23 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import json
import time
file = open("./piUp.json", encoding="utf-8")
#branje iz datoteke
print("Prebrano iz datoteke/poslano strezniku: ")
jsonFile = json.load(file)
print(jsonFile)
file.close()
import requests
started = time.time()
r = requests.post('http://192.168.0.120:30005/updateConf', json=jsonFile, verify=False)
#r = requests.get('http://192.168.0.120:30005/status',verify=False)
finish = time.time() - started
print("Odgovor streznika: ")
#response = r.text
#response = json.loads(r.json())
#print(r.json())
print(r.text)
response = r.json()
#print(response["status"],"status code:"+str(r.status_code))
print("configured:" + response["configured"])
print(response)
print("Trajalo je: "+str(round(finish,3))+"s")