Discussions

Ask a Question
Back to All

I can't use api by Python

I try to use python to access your api,but I only can get that result

<Response [500]>

here is my code:


import requests
import json

data = {
    "source_url": "//p6.itc.cn/images01/20230410/bf74518354884193b7a11cf443ca6112.jpeg",
    "script": {
        "type": "text",
        "input": "Hello world!"
    }
}

headers = {
    "Authorization":
    "Basic xxxxx:xxxxx",
    "User-Agent":
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63"}

url = "https://api.d-id.com/talks"

response = requests.post(url=url,data=json_data,headers=headers)

print(response)

by the way,I'm Chinese. Is this a network problem?

Looking forward to your help