虽然以下代码从学校的网站上检索了我的gpa,但我不禁想知道是否有比以下代码更快的方法:
import requests, json
login_url = "https://www.uml.edu/sso/Auth/Login?returnUrl=/student-dashboard"
url = "https://www.uml.edu/student-dashboard/api/Enrollment/Classes?term=2530&career=1"
email = raw_input("Enter School Email: ")
passwd = raw_input("Enter Email Password: ")
payload = {"EmailAddress" : email,
"Password" : passwd}
s = requests.Session()
s.post(login_url, data=payload)
r = requests.get(url, auth=(email, passwd))
result = json.loads(r.content)
print result.get('data').get('CareerCumulativeGpa')