今天再为大家介绍下使用Python爬虫库requests发送表单数据和JSON数据的方法,这是最基本的使用方法,大家可以参考测试下
导入Python爬虫库Requests
import requests
一、发送表单数据
要发送表单数据,只需要将一个字典传递给参数data
payload = {
'key1': 'value1', 'key2': 'value2'}
r = requests.post("http://httpbin.org/post", data=payload)
print(r.text)
{
"args":{
},"data":"","files":{
},"form":{
"key1"