# Python requests 一个 JSON 的请求

**URL:** <https://www.isharkfly.com/t/python-requests-json/16147>\
**Category:** 程序语言\
**Tags:** python\
**Created:** [August 15, 2024, 8:07pm UTC](https://www.isharkfly.com/t/python-requests-json/16147 "2024-08-15T20:07:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [August 15, 2024, 8:07pm UTC](https://www.isharkfly.com/t/python-requests-json/16147/1 "2024-08-15T20:07:59Z")

</div>

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

```auto
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 到服务器上。

 ![2024-08-15_16-08-53](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/b/b4c5199dff16dcf6acaca93249e803b7dcf23f3b.png)

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