Files
@ 732de39fb3cc
Branch filter:
Location: C3L-NOC/spaceapi/client.py - annotation
732de39fb3cc
1.5 KiB
text/x-python
pep8 state.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)
|