-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.py
104 lines (80 loc) · 2.79 KB
/
Main.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from flask import Flask
from flask import request
from flask import jsonify
from go import table_grade, table_certification, table_exam, table_tm, table_schedule, table_credit, login
from util import identifyRandcode
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
@app.route('/')
def hello_world():
return 'Hello World'
@app.route('/tk', methods=['post', 'get'])
def tk():
p = request.args.get('p')
type = request.args.get('type')
print(p)
print(type)
return jsonify({'t': [p, type]})
@app.route('/data', methods=['post'])
def data():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
result = login.go(studentnumber, password)
return jsonify(result)
@app.route('/schedule', methods=['post'])
def schedule():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_es_schedule = table_schedule.go(studentnumber, password)
return jsonify(t_es_schedule)
@app.route('/grade', methods=['post'])
def grade():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_es_grade = table_grade.go(studentnumber, password)
return jsonify(t_es_grade)
@app.route('/credit', methods=['post'])
def credit():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_es_credit = table_credit.go(studentnumber, password)
return jsonify(t_es_credit)
@app.route('/certification', methods=['post'])
def certification():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_es_certification = table_certification.go(studentnumber, password)
return jsonify(t_es_certification)
@app.route('/exam', methods=['post'])
def exam():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_es_exam = table_exam.go(studentnumber, password)
return jsonify(t_es_exam)
@app.route('/tm', methods=['post'])
def tm():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
t_tm = table_tm.go(studentnumber, password)
return jsonify(t_tm)
@app.route('/login', methods=['post'])
def loginIn():
data = request.json
studentnumber = data['studentnumber']
password = data['password']
current_student = login.student(studentnumber, password)
current_student.getCheckCodeImage()
orginalCheckCode = identifyRandcode.identify_randcode('image/original_img.jpg',
'image/adjusted_img.jpg')
checkCode = orginalCheckCode[0:5]
current_student.login(checkCode)
return jsonify({"code": "200", "data": "success"})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)