-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
59 lines (43 loc) · 1.29 KB
/
server.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
49
50
51
52
53
54
55
56
57
58
59
#!/bin/python3
from flask import Flask,Response,redirect,request
from pluglings.pluglings import *
from pluglings.course import getCourse
# from coursetest import getCourse
app=Flask(__name__)
def responseJson(content):
return Response(json.dumps(content), mimetype='application/json')
@app.get('/')
def gohome():
return redirect('http://localhost:5000/static/index.html',code=301)
@app.get("/getip")
def rgetip():
return responseJson(getIP())
@app.get('/getbattery')
def rgetbattery():
return responseJson(getbattery())
@app.get('/getLoginUrl')
def rgetLoginUrl():
return responseJson(getLoginUrl())
@app.get('/getLoginInfo')
def rgetLoginInfo():
key=request.args.get("oauthkey")
return responseJson(getLoginInfo(key))
@app.get('/getbilistate')
def rgetbilistate():
key=request.args.get("mid")
return responseJson(getBiliCard(key))
@app.get('/getupstate')
def rgetupstate():
key=request.args.get('mid')
return responseJson(getupstate(key))
@app.get('/getDormitoryPower')
def rgetDormitoryPower():
return responseJson(getDormitoryPower())
@app.get('/getCardMoney')
def rgetCardMoney():
return responseJson(getCardMoney())
@app.get('/getcourse')
def rgetCourse():
return responseJson(getCourse())
if __name__=='__main__':
app.run(host="0.0.0.0")