呂紹榕 Louie Lu
2014/10/25 TANet 2014 @ ICCK
______________________________________________________________
呂紹榕、連浩智、姜尚德、詹濬鍵
HTML (with only IE)
JSON
HTML5
我不太會論文簡報
但我們可以談談整個 Project 始末
那時候不會寫 APP,
就用 GreaseMonkey 解決這個問題
畢竟我的繳費單印完了,我也能不用 IE 就查成績
import requests
AP_LOGIN_URL = "http://140.127.113.227/kuas/perchk.jsp"
def login(username, password):
s = requests.session()
data = {"uid": username, "pwd": password}
r = s.post(AP_LOGIN_URL, data=data)
return s
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
def login(session, username, password):
data = {"uid": username, "pwd": password}
r = session.post(AP_LOGIN_URL, data=data, timeout=LOGIN_TIMEOUT)
root = etree.HTML(r.text)
try:
is_login = not root.xpath("//script")[-1].text.startswith("alert")
except:
is_login = False
return is_login
def login(session, username, password):
data = {"uid": username, "pwd": password}
r = session.post(AP_LOGIN_URL, data=data, timeout=LOGIN_TIMEOUT)
root = etree.HTML(r.text)
try:
is_login = not root.xpath("//script")[-1].text.startswith("alert")
except:
is_login = False
return is_login
<script language='javascript'>
alert('[11] 無此帳號或密碼不正確,請重新輸入。');
top.location.href='index.html';
</script>
@app.route('/ap/login', methods=['POST'])
@cross_origin(supports_credentials=True)
def login_post():
if request.method == "POST":
session.permanent = True
# Start login
username = request.form['username']
password = request.form['password']
s = requests.Session()
is_login = function.login(s, username, password)
if is_login:
# Serialize cookies with domain
session['c'] = dump_cookies(s.cookies)
session['username'] = username
return "true"
else:
return "false"
return render_template("login.html")
>>> import requests
>>> s = requests.Session()
>>> r = s.post("http://localhost:5000/ap/login",
... data={"username": "1102108133", "password": "111"}
... )
>>> r.text
'true'
➜ AP-API git:(develop) ✗ python2 web-server.py
* Running on http://0.0.0.0:5000/
* Restarting with reloader
127.0.0.1 - - [22/Oct/2014 21:20:41] 'POST /ap/login HTTP/1.1' 200 -
>>> r.text
'true'
>>> r = s.post("http://localhost:5000/ap/query",
... data={"fncid": "ag222", "arg01": "103", "arg02": "01"}
... )
>>> r.text
'[{"0": {"1": {"course_name": "", "course_teacher": "", "course_c...
➜ AP-API git:(develop) ✗ python2 web-server.py
* Running on http://0.0.0.0:5000/
* Restarting with reloader
127.0.0.1 - - [22/Oct/2014 21:20:41] 'POST /ap/login HTTP/1.1' 200 -
127.0.0.1 - - [22/Oct/2014 21:27:05] 'POST /ap/query HTTP/1.1' 200 -
Meda Queries
使用者人數
Why need a Middleware Server?
or say Proxy Server?
ssh to server...
grd@kuasap:~$ sudo iptables -F
---
Chain INPUT (policy DROP)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
負載
負載
使用狀況 (9/2 ~ 10/22)
使用狀況 (9/2 ~ 10/22)
@Google Play & App Store
不知道給我們使用的API,會是只對我們開放?還是對其他同學也會呢?
“
如果開放 API 會產生很多實驗型計畫,也會讓 DB 內部的資料(包含個資)更容易曝光。
礙於計中有限的人力,處理學校交辦的事情已經有點焦頭爛額了,很難有多餘的心力經營這一塊!
“
Events
/events
/events/{site}
/events/{site}/{id}
/events/holidays
News
/news
/news/{site}
/news/{site}/{id}
Weather
/weather/current
Terms
/terms/list
/terms/{term_id}/examschedule
/terms/{term_id}/{subject}/schedule
/terms/{term_id}/{subject}/{catalog_number}/schedule
/terms/{term_id}/infosessions
Resources
/resources/tutors
/resources/printers
/resources/infosessions
/resources/goosewatch
Definitions and Codes
/codes/units
/codes/terms
/codes/groups
/codes/subjects
/codes/instructions
有 API 是高應大的一小步,校園資訊發展的一大步
“
Special Thanks
鐘文鈺 老師