Python requests 一个 JSON 的请求

Post 请求的问题在于如何组织参数。

import requests

url = 'https://www.w3schools.com/python/demopage.php'
PARAMS = {'somekey': 'somevalue'}

r = requests.post(url=url , json=PARAMS)

#print the response text (the content of the requested file):

print(x.text)

上面可以把请求 POST 到服务器上。

Post 到服务器后返回的结果。

1 Like