Files
@ 9f1ca2d335b5
Branch filter:
Location: C3L-NOC/spaceapi/client.py - annotation
9f1ca2d335b5
1.5 KiB
text/x-python
use frozenset instead of tuples in sensors.py
16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 16160deb284a 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 16160deb284a 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 7870fa269c43 16160deb284a 7870fa269c43 7870fa269c43 16160deb284a 16160deb284a 7870fa269c43 7870fa269c43 7870fa269c43 16160deb284a | import requests
import json
import time
from requests.auth import HTTPDigestAuth
base_url = 'http://localhost:5000'
auth = HTTPDigestAuth('test', 'test')
# print("Testing setting state to closed")
# payload = {"value": False}
# r = requests.post(base_url + '/state/set/open',
# auth=auth,
# data=json.dumps(payload))
# print(r.text)
#
# time.sleep(1)
#
# print("Testing setting message")
# payload = {"value": "Test message"}
# auth = HTTPDigestAuth('test', 'test')
#
# r = requests.post(base_url + '/state/set/message', auth=auth,
# data=json.dumps(payload))
# print(r.text)
# time.sleep(1)
#
# print("Testing setting trigger person")
# payload = {"value": "metalgamer"}
# auth = HTTPDigestAuth('test', 'test')
#
# r = requests.post(base_url + '/state/set/trigger_person',
# auth=auth,
# data=json.dumps(payload))
# print(r.text)
# time.sleep(1)
# print("Testing setting active members")
# payload = {"name": "Active members", "value": 24}
# auth = HTTPDigestAuth('test', 'test')
#
# r = requests.post(base_url + '/sensors/set/total_member_count',
# auth=auth,
# data=json.dumps(payload))
# print(r.text)
print("Testing setting temperature")
payload = {"name": "Test", "location": "Test", "unit": "°C", "value": 24}
auth = HTTPDigestAuth('test', 'test')
r = requests.post(base_url + '/sensors/set/temperature',
auth=auth,
data=json.dumps(payload))
print(r.text)
|