美文网首页
POST请求-自动填写表单进行提交

POST请求-自动填写表单进行提交

作者: tonyemail_st | 来源:发表于2017-10-20 21:55 被阅读0次
import urllib.request
import urllib.parse
posturl="http://www.iqianyue.com/mypost"
postdata=urllib.parse.urlencode({
    "name":"ceo@example.com",
    "pass":"asdfjlkjlknhasd",
    }).encode("utf-8")
req=urllib.request.Request(posturl,postdata)
rst=urllib.request.urlopen(req).read().decode("utf-8")
print(rst)

fh=open("E:\\python_spider\\tmp\\test.html", 'w')
fh.write(rst)

相关文章

网友评论

      本文标题:POST请求-自动填写表单进行提交

      本文链接:https://www.haomeiwen.com/subject/cylbuxtx.html