-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
85 lines (64 loc) · 2.68 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
from flask import Flask
from flask import request as rq
import token_srm
import attendence_marks
import timetable
import course_personal_details
import json
from flask import Response
app = Flask(__name__)
@app.route('/')
def home():
json_o = {"status": "success", "msg": "*** ACADEMIA API WITH PYTHON *** By Yogesh Kumawat & Abhishek"}
json_o = json.dumps(json_o)
return json_o
@app.route('/token', methods=['GET', 'POST'])
def request():
if 'email' in rq.args and 'pass' in rq.args:
response = token_srm.getToken(rq.args.get('email'), rq.args.get('pass'))
response = Response(response, status=200, mimetype='application/json')
return response
else:
response = {"status":"error", "msg":"Error in Input Parameters"}
response = json.dumps(response)
response = Response(response, status=200, mimetype='application/json')
return response
@app.route('/AttAndMarks', methods=['GET', 'POST'])
def AttAndMarks():
if 'token' in rq.args:
token = str(rq.args.get('token'))
att_marks = attendence_marks.getAttendenceAndMarks(token)
response = Response(att_marks, status=200, mimetype='application/json')
return response
else:
response = {"status": "error", "msg": "Error in Input Parameters"}
response = json.dumps(response)
response = Response(response, status=200, mimetype='application/json')
return response
@app.route('/TimeTable', methods=['GET', 'POST'])
def TimeTable():
if 'batch' in rq.args and 'token' in rq.args:
batchNo = rq.args.get('batch')
token = rq.args.get('token')
timeTable = timetable.getTimeTable(token, batchNo)
response = Response(timeTable, status=200, mimetype='application/json')
return response
else:
response = {"status": "error", "msg": "Error in Input Parameters"}
response = json.dumps(response)
response = Response(response, status=200, mimetype='application/json')
return response
@app.route('/PersonalDetails', methods=['GET', 'POST'])
def getPersonalDetails():
if 'token' in rq.args:
token = rq.args.get('token')
details = course_personal_details.getCoursePersonalDetails(token)
response = Response(details, status=200, mimetype='application/json')
return response
else:
response = {"status": "error", "msg": "Error in Input Parameters"}
response = json.dumps(response)
response = Response(response, status=200, mimetype='application/json')
return response
if __name__ == '__main__':
app.run(debug=True)