使用 requests 发送 POST 请求

POST请求也就是向服务器提交数据,通常我们用来提交表单数据:

import requests

postdata = {              //定义表单数据
    "username": "abc",
    "password": 123456
}

req = requests.post("http://www.xxxx.com/login", data=postdata)    //使用post()方法发送POST请求
print(req.text)

 

 

 

 

 

 

 

     

posted @ 2019-03-14 16:33  孔雀东南飞  阅读(297)  评论(0编辑  收藏  举报