python 实现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())