import requests
# ses = requests.Session()
# first_url = "http://112.74.185.30:8080/yiban-web/stu/toSubject.jhtml?courseId=8"
# first_headers={
# 'host': '112.74.185.30:8080',
# 'Accept-Encoding': 'gzip, deflate',
# 'Upgrade-Insecure-Requests': '1',
# 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1',
# 'Referer': 'http://112.74.185.30:8080/yiban-web/stu/toCourse.jhtml',
# 'DNT': '1',
# 'Connection': 'keep-alive',
# }
# first_cookies = {'JSESSIONID': '0D7E4E12942F878489DEA60B97561F8F'}
# res=ses.get(url=first_url,cookies=first_cookies)
headers = {
'host': '112.74.185.30:8080',
'Accept': 'application/json',
'X-Requested-With': 'XMLHttpRequest',
'Accept-Language': 'zh-cn',
'Accept-Encoding': 'gzip, deflate',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'http://112.74.185.30:8080',
'Content-Length': '57',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1',
'Referer': 'http://112.74.185.30:8080/yiban-web/stu/toSubject.jhtml?courseId=8',
'DNT': '1',
'Connection': 'keep-alive',
'Cookie': 'xxx',
}
data={
'answer':'A',
'courseId':'8',
'uuid':'EB180D559F46426DAD2E9916DEA501DBxxxxxx'
}
res =
requests.post(url='http://112.74.185.30:8080/yiban-web/stu/changeSituation.jhtml?_=1526406696684',headers=headers, data=data)
print(res.text)
====================================
注释里 GET 得到的页面里,有个 UUID 在一段 JS 代码里,然后我想得到这个 UUID 并且加到 DATA 中去 POST 刚刚 GET 得到的内容