网页 api
from __future__ import absolute_import, unicode_literals
from flask import Flask, request, jsonify
from school_api import SchoolClient
app = Flask(__name__)
school = SchoolClient('http://61.142.33.204')
@app.route('/get_info')
def get_info():
account = request.args.get("account")
passwd = request.args.get("passwd")
user = school.user_login(account, passwd)
return jsonify(user.get_info())
@app.route('/get_score')
def get_score():
account = request.args.get("account")
passwd = request.args.get("passwd")
user = school.user_login(account, passwd)
return jsonify(user.get_score())
@app.route('/get_schedule')
def get_schedule():
account = request.args.get("account")
passwd = request.args.get("passwd")
user = school.user_login(account, passwd)
schedule_year = '2015-2016'
schedule_term = '2'
schedule_data = user.get_schedule(schedule_year, schedule_term)
return jsonify(schedule_data)
if __name__ == '__main__':
app.run()