欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-05-02 11:26:48
具体代码如下: import requests import json data={"ids": ["00007190","00007191"]} ur...

具体代码如下:

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)

以上这篇python用post访问restful服务接口的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。