Python-requests模块

Post

post-表单请求
import requests
url = ""
headers = {"accept": "application/json"}
data = {"key1": "value1"}
# 发送POST请求-提交表单信息
response = requests.post(url=url, headers=headers, data=data)
print(response.text)
post-json请求
import requests
url = ""
headers = {"accept": "application/json"}
data = {"key1": "value1"}
# 发送POST请求-提交json信息
response = requests.post(url=url, headers=headers, json=data)
print(response.text)

你可能感兴趣的:(python语言)