要发送POST请求,可以使用Python的requests库。以下是一个简单的示例:

import requests

# 设置请求的URL和参数
url = 'http://example.com/api/post'
payload = {'name': 'John', 'age': 30}

# 发送POST请求
response = requests.post(url, data=payload)

# 打印响应结果
print(response.text)

在这个示例中,我们首先设置了请求的URL和参数。然后,我们使用requests.post()函数发送POST请求,并将参数作为data参数传递。最后,我们打印响应结果。

python发送post请求

原文地址: https://www.cveoy.top/t/topic/qvG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录