forked from xasos/UIUC-API
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlaundry.py
41 lines (35 loc) · 1.07 KB
/
laundry.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
from flask_restful import Resource
import urllib2
import json
import redis
class Laundry(Resource):
def get(self):
r = redis.StrictRedis(host='localhost', port=6379, db=0)
#print str(json.load(response))
output =""
try:
output = json.loads(r.get('app.tasks.laundry'))
except Exception as e:
output = str(e)
return output
#This does not really work, because id is changed randomly
class LaundryID(Resource):
def get(self, id):
r = redis.StrictRedis(host='localhost', port=6379, db=0)
#print str(json.load(response))
output =""
try:
output = json.loads(r.get(str(id)))
except Exception as e:
output = str(e)
return output
class LaundryName(Resource):
def get(self, name):
r = redis.StrictRedis(host='localhost', port=6379, db=0)
#print str(json.load(response))
output =""
try:
output = json.loads(r.get(name))
except Exception as e:
output = str(e)
return output