def bus_reservations(bus_id=None, cancel_key=None): # Restore cookies s = stateless_auth.get_requests_session_with_cookies() # Debugging user_agent = request.user_agent.string user_id = g.username if request.method == "GET": return jsonify(reservation=cache.bus_reserve_query(s)) elif request.method == "PUT": result = cache.bus_booking(s, bus_id, "") try: print("PUT,%s,%s,%s" % (user_agent, user_id, result)) except: print("PUT ERROR, %s, %s" % (user_agent, user_id)) return jsonify(result) elif request.method == "DELETE": result = cache.bus_booking(s, cancel_key, "un") print("DELETE,%s,%s,%s" % (user_agent, user_id, result)) return jsonify(result) return request.method
def get_coursetables(year, semester): # See Gist for more infomation. # https://gist.github.com/hearsilent/a2570371cc6aa7db97bb weekdays = {"M": "Monday", "T": "Tuesday", "W": "Wednesday", "R": "Thursday", "F": "Friday", "S": "Saturday", "H": "Sunday" } # Restore cookies s = stateless_auth.get_requests_session_with_cookies() classes = cache.ap_query( s, "ag222", {"arg01": year, "arg02": semester, "uid": "1101133117"}, g.username) # No Content if not classes: return jsonify(status=const.no_content, messages="學生目前無選課資料", coursetables=classes) coursetables = {} for c in classes: weekday = weekdays[c["date"]["weekday"]] if not weekday in coursetables: coursetables[weekday] = [] coursetables[weekday].append(c) return jsonify(status=const.ok, messages="", coursetables=coursetables)
def get_leave(year, semester): """Get user's leaves record. :reqheader Authorization: Using Basic Auth :query int year: Specific year to query class schedule. format: yyy (see below) :query int semester: Given a semester :statuscode 200: Query successful :statuscode 401: Login failed or auth_token has been expired **Request** .. sourcecode:: http GET /latest/leaves/105/2 HTTP/1.1 Host: kuas.grd.idv.tw:14769 Authorization: Basic xxxxxxxxxxxxx= .. sourcecode:: shell curl -X GET -u username:password https://kuas.grd.idv.tw:14769/latest/leaves/105/2 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json """ timecode = [ "A", "1", "2", "3", "4", "B", "5", "6", "7", "8", "C", "11", "12", "13", "14" ] # Restore cookies s = stateless_auth.get_requests_session_with_cookies() leaves = cache.leave_query(s, year, semester) if not leaves: return jsonify(status=const.no_content, messages="本學期無缺曠課記錄", leaves=[]) else: #leaves.append() return jsonify(status=const.ok, messages="", leaves=leaves,timecode=timecode)
def get_leave(year, semester): # Restore cookies s = stateless_auth.get_requests_session_with_cookies() leaves = cache.leave_query(s, year, semester) if not leaves: return jsonify(status=const.no_content, messages="本學期無缺曠課記錄", leaves=[]) else: return jsonify(status=const.ok, messages="", leaves=leaves)
def get_score(year, semester): # Restore cookies s = stateless_auth.get_requests_session_with_cookies() scores = cache.ap_query( s, "ag008", {"arg01": year, "arg02": semester, "arg03": g.username}, g.username) if not scores: return jsonify(status=const.no_content, messages="目前無學生個人成績資料", scores={}) return jsonify(status=const.ok, messages="", scores=scores)
def get_leave(year, semester): """Get user's leaves record. :reqheader Authorization: Using Basic Auth :query int year: Specific year to query class schedule. format: yyy (see below) :query int semester: Given a semester :statuscode 200: Query successful :statuscode 401: Login failed or auth_token has been expired **Request** .. sourcecode:: http GET /latest/leaves/105/2 HTTP/1.1 Host: kuas.grd.idv.tw:14769 Authorization: Basic xxxxxxxxxxxxx= .. sourcecode:: shell curl -X GET -u username:password https://kuas.grd.idv.tw:14769/latest/leaves/105/2 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json """ timecode = [ "A", "1", "2", "3", "4", "B", "5", "6", "7", "8", "C", "11", "12", "13", "14" ] # Restore cookies s = stateless_auth.get_requests_session_with_cookies() leaves = cache.leave_query(s, year, semester) if not leaves: return jsonify(status=const.no_content, messages="本學期無缺曠課記錄", leaves=[]) else: #leaves.append() return jsonify(status=const.ok, messages="", leaves=leaves, timecode=timecode)
def version_2(): """Return API version """ return jsonify(name="kuas-api version 2.", version="2", server_revision=get_git_revision_short_hash(), endpoints="https://kuas.grd.idv.tw:14769/v2/")
def version_2(): """Return API version """ return jsonify( name="kuas-api version 2.", version="2", server_revision=get_git_revision_short_hash(), endpoints="https://kuas.grd.idv.tw:14769/v2/" )
def notification(page): """Get KUAS notification :param int page: specific page for notifications **Request** .. sourcecode:: http GET /v2/notifications/1 HTTP/1.1 Host: https://kuas.grd.idv.tw:14769/v2/notifications/1 .. sourcecode:: shell curl -X GET https://kuas.grd.idv.tw:14769/v2/notifications/1 **Response** .. sourcecode:: http HTTP/1.0 200 OK Content-Type: application/json { "page":1, "notification":[ { "link":"http://student.kuas.edu.tw/files/13-1002-45032-1.php", "info":{ "title":"『鄭豐喜國外深造獎助學金』104年度申請辦法公告", "date":"2015-09-04 ", "id":"1", "department":"諮商輔導中心" } }, { "link":"http://gender.kuas.edu.tw/files/13-1005-45026-1.php", "info":{ "title":"轉知社團法人台灣愛之希望協會辦理-104年同志公民運動系列活動,歡迎踴躍參加。", "date":"2015-09-04 ", "id":"2", "department":"性別平等專區" } }, {}, {} ] } """ return jsonify( page=page, notification=cache.notification_query(page) )
def get_sample_coursetables(): sample_data = { "normal": {'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'instructors': ['張道行'], 'title': '演算法'}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'instructors': ['張道行'], 'title': '演算法'}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'instructors': ['張道行'], 'title': '演算法'}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['楊孟翰'], 'title': '資料庫'}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['楊孟翰'], 'title': '資料庫'}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['楊孟翰'], 'title': '資料庫'}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'instructors': ['詹喆君'], 'title': '延伸通識(人文)-音樂賞析'}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'instructors': ['詹喆君'], 'title': '延伸通識(人文)-音樂賞析'}], 'Tuesday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'instructors': ['陳忠信'], 'title': '體育-羽球'}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'instructors': ['陳忠信'], 'title': '體育-羽球'}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'instructors': ['林威成'], 'title': '離散數學'}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'instructors': ['林威成'], 'title': '離散數學'}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'instructors': ['林威成'], 'title': '離散數學'}], 'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'instructors': ['林良志'], 'title': '核心通識(五)-民主與法治'}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'instructors': ['林良志'], 'title': '核心通識(五)-民主與法治'}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'instructors': ['鐘文鈺'], 'title': '資料壓縮'}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'instructors': ['鐘文鈺'], 'title': '資料壓縮'}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'instructors': ['鐘文鈺'], 'title': '資料壓縮'}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['王志強'], 'title': '作業系統'}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['王志強'], 'title': '作業系統'}, {'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['王志強'], 'title': '作業系統'}]}, "weekends": {'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}], 'Sunday': [{'date': {'weekday': 'H', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '實務專題(一)', 'instructors': ['羅孟彥']}, {'date': {'weekday': 'H', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '', 'building': ''}, 'title': '實務專題(一)', 'instructors': ['羅孟彥']}, {'date': {'weekday': 'H', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '', 'building': ''}, 'title': '實務專題(一)', 'instructors': ['羅孟彥']}, {'date': {'weekday': 'H', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '', 'building': ''}, 'title': '英語能力訓練', 'instructors': ['秦月貞']}, {'date': {'weekday': 'H', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '', 'building': ''}, 'title': '英語能力訓練', 'instructors': ['秦月貞']}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}], 'Tuesday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}], 'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}]}, "aftereight": {'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}], 'Tuesday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}], 'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:00', 'start_time': '20:20', 'section': '第 13 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '', 'start_time': '', 'section': 'B'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '19:20', 'start_time': '18:30', 'section': '第 11 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}]}, "all": {'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}], 'Sunday': [{'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}, {'date': {'weekday': 'H', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': 'HS202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}], 'Tuesday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}], 'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:00', 'start_time': '20:20', 'section': '第 13 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '', 'start_time': '', 'section': 'B'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '19:20', 'start_time': '18:30', 'section': '第 11 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}]}, "multiinstructors": {'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}], 'Sunday': [{'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}, {'date': {'weekday': 'H', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': 'HS202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}, {'date': {'weekday': 'H', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': 'HS202', 'building': ''}, 'instructors': ['RegisterAutumn', '紅寶石', '藍寶石'], 'title': '5倍紅寶石'}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}], 'Tuesday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}], 'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:00', 'start_time': '20:20', 'section': '第 13 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '', 'start_time': '', 'section': 'B'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '19:20', 'start_time': '18:30', 'section': '第 11 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}]}, "wtf": {'Monday': [{'date': {'weekday': 'M', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '核心通識(五)-民主與法治', 'instructors': ['林良志']}, {'date': {'weekday': 'M', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}, {'date': {'weekday': 'M', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '育302', 'building': ''}, 'title': '資料壓縮', 'instructors': ['鐘文鈺']}], 'Sunday': [{'date': {'weekday': 'T', 'end_time': '09:00', 'start_time': '08:10', 'section': '第 1 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '', 'building': ''}, 'title': '體育-羽球', 'instructors': ['陳忠信']}, {'date': {'weekday': 'T', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南108', 'building': ''}, 'weekday': 'F', 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}, {'date': {'weekday': 'T', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南108', 'building': ''}, 'title': '離散數學', 'instructors': ['林威成']}], 'Thursday': [{'date': {'weekday': 'R', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '資料庫', 'instructors': ['楊孟翰']}, {'date': {'weekday': 'R', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}, {'date': {'weekday': 'R', 'end_time': '17:20', 'start_time': '16:30', 'section': '第 8 節'}, 'location': {'room': 'HS210', 'building': ''}, 'title': '延伸通識(人文)-音樂賞析', 'instructors': ['詹喆君']}], 'Tuesday': [{'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'H', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}, {'date': {'weekday': 'H', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'location': {'room': 'HS202', 'building': ''}, 'instructors': ['RegisterAutumn'], 'title': '5倍紅寶石'}, {'date': {'weekday': 'H', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': 'HS202', 'building': ''}, 'instructors': ['RegisterAutumn', '紅寶石', '藍寶石'], 'title': '5倍紅寶石'}], 'Wednesday': [{'date': {'weekday': 'W', 'end_time': '14:20', 'start_time': '13:30', 'section': '第 5 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '15:20', 'start_time': '14:30', 'section': '第 6 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '16:20', 'start_time': '15:30', 'section': '第 7 節'}, 'location': {'room': '南101', 'building': ''}, 'title': '演算法', 'instructors': ['張道行']}, {'date': {'weekday': 'W', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:00', 'start_time': '20:20', 'section': '第 13 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}, {'date': {'weekday': 'W', 'end_time': '21:15', 'start_time': '22:05', 'section': '第 14 節'}, 'location': {'room': '資202', 'building': ''}, 'instructors': ['Awei'], 'title': '實用網路安全技術'}], 'Friday': [{'date': {'weekday': 'F', 'end_time': '10:00', 'start_time': '09:10', 'section': '第 2 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'date': {'weekday': 'F', 'end_time': '11:00', 'start_time': '10:10', 'section': '第 3 節'}, 'location': {'room': '資201', 'building': ''}, 'title': '作業系統', 'instructors': ['王志強']}, {'location': {'room': '資201', 'building': ''}, 'campus': 'Yanchao', 'building': '資', 'room': '201', 'date': {'weekday': 'F', 'end_time': '12:00', 'start_time': '11:10', 'section': '第 4 節'}, 'instructors': ['王志強'], 'title': '作業系統'}, {'date': {'weekday': 'F', 'end_time': '', 'start_time': '', 'section': 'B'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '19:20', 'start_time': '18:30', 'section': '第 11 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}, {'date': {'weekday': 'F', 'end_time': '20:15', 'start_time': '19:25', 'section': '第 12 節'}, 'location': {'room': '資201', 'building': ''}, 'instructors': ['John Thunder'], 'title': '黑客技巧'}]}, } return jsonify(sample_data[request.path[request.path.rfind("/") + 1:]])
def notification(page): """Get KUAS notification :param int page: specific page for notifications **Request** .. sourcecode:: http GET /v2/notifications/1 HTTP/1.1 Host: https://kuas.grd.idv.tw:14769/v2/notifications/1 .. sourcecode:: shell curl -X GET https://kuas.grd.idv.tw:14769/v2/notifications/1 **Response** .. sourcecode:: http HTTP/1.0 200 OK Content-Type: application/json { "page":1, "notification":[ { "link":"http://student.kuas.edu.tw/files/13-1002-45032-1.php", "info":{ "title":"『鄭豐喜國外深造獎助學金』104年度申請辦法公告", "date":"2015-09-04 ", "id":"1", "department":"諮商輔導中心" } }, { "link":"http://gender.kuas.edu.tw/files/13-1005-45026-1.php", "info":{ "title":"轉知社團法人台灣愛之希望協會辦理-104年同志公民運動系列活動,歡迎踴躍參加。", "date":"2015-09-04 ", "id":"2", "department":"性別平等專區" } }, {}, {} ] } """ return jsonify(page=page, notification=cache.notification_query(page))
def ap_semester(): semester_list = ap.get_semester_list() default_yms = list( filter(lambda x: x['selected'] == 1, semester_list))[0] # Check default args if request.args.get("default") == "1": return jsonify(default=default_yms) # Check limit args limit = request.args.get("limit") if limit: try: semester_list = semester_list[: int(limit)] except ValueError: return error.error_handle( status=400, developer_message="Error value for limit.", user_message="You type a wrong value for limit.") return jsonify( semester=semester_list, default=default_yms )
def timetables(): """Get KUAS school bus time table. :reqheader Authorization: Using Basic Auth :query string date: Specific date to query timetable. format: yyyy-mm-dd :query string from: The start station you want to query. (not impl yet) :statuscode 200: no error **Request** without date (default the date on server) .. sourcecode:: http GET /latest/bus/timetables HTTP/1.1 Host: kuas.grd.idv.tw:14769 Authorization: Basic xxxxxxxxxxxxx= .. sourcecode:: shell curl -u username:password -X GET https://kuas.grd.idv.tw:14769/v2/bus/timetables with date .. sourcecode:: http GET /latest/bus/timetables?date=2015-9-1 HTTP/1.1 Host: kuas.grd.idv.tw:14769 Authorization: Basic xxxxxxxxxxxxx= .. sourcecode:: shell curl -u username:password -X GET https://kuas.grd.idv.tw:14769/v2/bus/timetables?date=2017-08-09 **Response** .. sourcecode:: http HTTP/1.0 200 OK Content-Type: application/json { "timetable":[ { "endStation":"燕巢", "EndEnrollDateTime":"2015-08-31 17:20", "isReserve":-1, "Time":"08:20", "busId":"27034", "limitCount":"999", "reserveCount":"27", "runDateTime":"2015-09-01 08:20" }, { "endStation":"燕巢", "EndEnrollDateTime":"2015-09-01 08:00", "isReserve":-1, "Time":"13:00", "busId":"27062", "limitCount":"999", "reserveCount":"1", "runDateTime":"2015-09-01 13:00" }, { "endStation":"建工", "EndEnrollDateTime":"2015-09-01 07:15", "isReserve":-1, "Time":"12:15", "busId":"27090", "limitCount":"999", "reserveCount":"5", "runDateTime":"2015-09-01 12:15" }, { "endStation":"建工", "EndEnrollDateTime":"2015-09-01 11:45", "isReserve":-1, "Time":"16:45", "busId":"27118", "limitCount":"999", "reserveCount":"24", "runDateTime":"2015-09-01 16:45" } ], "date":"2015-9-1" } """ date = time.strftime("%Y-%m-%d", time.gmtime()) if request.args.get("date"): date = request.args.get("date") # Restore cookies s = stateless_auth.get_requests_session_with_cookies() return jsonify(date=date, timetable=cache.bus_query(s, date))