python实现post传参

python 实现post传参

bugku-POST

注意传入data要解码

import urllib.request

baseurl = "http://114.67.246.176:13937/"
headers = {
	"User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36" 
}
data = {
	'what' : 'flag' 
}
data = urllib.parse.urlencode(data).encode("utf-8")
req = urllib.request.Request(url = baseurl, headers = headers, data = data, method = "POST")
response = urllib.request.urlopen(req)
print(response.read())
上一篇:爬虫之旅(二):爬取b站搜索数据


下一篇:KubeEdge架构问题汇总