V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  Ruohua3kou  ›  全部回复第 6 页 / 共 6 页
回复总数  101
1  2  3  4  5  6  
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 得到的内容
1  2  3  4  5  6  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2658 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 12:08 · PVG 20:08 · LAX 05:08 · JFK 08:08
♥ Do have faith in what you're doing.