当前位置:主页 > 软件编程 > Python代码 >

python用post访问restful服务接口的方法

时间:2021-06-27 08:20:19 | 栏目:Python代码 | 点击:

具体代码如下:

import requests
import json
data={"ids": ["00007190","00007191"]}

url="http://XXXXX"
data_json = json.dumps(data)
headers = {'Content-type': 'application/json'}
response = requests.post(url, data=data_json, headers=headers)
print(response.text)

您可能感兴趣的文章:

相关文章