如何在 Python 中为 Ant 媒体 API 发送 post 请求

How to send post request in Python for Ant media API

我正在尝试编写一个 python HTTP 请求代码以通过其 API 之一将数据发送到 Ant 媒体服务器。但是我无法发送 POST 请求,但是我在 GET 请求中成功了。

import requests 
url = "http://localhost:5080/LiveApp/rest/broadcast/create"

body12 = {
    "name": "TESTAPIsss",
    "description":"hiiii",
    "type": "streamSource",
    "streamId":"650320906975923279669775",  
    "streamUrl": "rlink"
}
headers = {'content-type': 'application/json'}

x = requests.post(url, data=body12, headers=headers)

print(x.text)

我遇到的错误是

Unrecognized token 'name': was expecting 'null', 'true', 'false' or NaN at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 6]

此答案不再有效。