import json
def doit(email,encrypted_password):
s = requests.Session()
#登陆
logininfo = {'encrypted_password':encrypted_password,'remember_me':'true','email':email}
login = s.post('http://geeklab.cc/users/sessions/auth',data=logininfo)
print(login.status_code) #200
print(login.text) #{"status":0,"code":1,"msg":"登陆成功","url":"/assignments"}
#获取任务列表
jobList = s.get('http://geeklab.cc/assignments/fresh?page=1')
print(jobList.status_code) # 200 (如果是正常返回 json 因该是 304 )
jobListJson = json.loads(jobList.text)
info = jobListJson['assignments']
print(info)
研究好久不知道问题出在哪里了
def doit(email,encrypted_password):
s = requests.Session()
#登陆
logininfo = {'encrypted_password':encrypted_password,'remember_me':'true','email':email}
login = s.post('http://geeklab.cc/users/sessions/auth',data=logininfo)
print(login.status_code) #200
print(login.text) #{"status":0,"code":1,"msg":"登陆成功","url":"/assignments"}
#获取任务列表
jobList = s.get('http://geeklab.cc/assignments/fresh?page=1')
print(jobList.status_code) # 200 (如果是正常返回 json 因该是 304 )
jobListJson = json.loads(jobList.text)
info = jobListJson['assignments']
print(info)
研究好久不知道问题出在哪里了