forked from robotstreamer/robotstreamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
http_example_interface.py
41 lines (23 loc) · 942 Bytes
/
http_example_interface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import requests
from time import sleep
URL = "http://192.168.178.28/"
def init():
print("init")
def handleCommand(command, keyPosition, price=0):
print("***********************************", command)
if command == 'F':
print("command is F")
PARAMS = {'value':50}
print(URL, PARAMS)
r = requests.get(url = URL, params = PARAMS)
print(r)
print(r.content)
if command == 'B':
print("command is B")
PARAMS = {'value':100}
print(URL, PARAMS)
r = requests.get(url = URL, params = PARAMS)
print(r)
print(r.content)
# routing
#{"F": forward, "B": back, "L": left, "R": right}