-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserveur.py
48 lines (39 loc) · 1.13 KB
/
serveur.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
42
43
44
45
46
47
48
# coding: utf8
import web
import models
urls = (
'/move', 'move',
'/action', 'action',
)
app = web.application(urls, globals())
class move:
def GET(self):
direction = web.ctx.query.split('=')[1]
if direction.upper() == "F":
models.m1.clockwise()
models.m2.clockwise()
elif direction.upper() == "B":
models.m1.counter_clockwise()
models.m2.counter_clockwise()
elif direction.upper() == "R":
models.m1.counter_clockwise()
models.m2.clockwise()
elif direction.upper() == "L":
models.m1.clockwise()
models.m2.counter_clockwise()
elif direction.upper() == "S":
models.m1.stop()
models.m2.stop()
else:
print("movement non supporte")
return 'OK'
class action:
def GET(self):
action = web.ctx.query.split('=')[1]
if action == "1":
models.u.getdistance()
else:
print("action non supportee")
return 'OK'
if __name__ == "__main__":
app.run()