AI Translate

부분 유료
분류별 binbin he | 업데이트됨 לפני 5 ימים | Translation
인기

9.8 / 10

지연 시간

751ms

서비스 수준

100%

Health Check

100%

모든 토론으로 돌아가기

Return nothing when trying to translate an html document using python

Rapid account: Bragandassi
bragandassi
לפני שנה

This is what i get when tried to translate an html document from english to french:
API response is not a list: {‘code’: 200, ‘texts’: [‘你好。 世界!’, ‘<b>你好。 谷歌!</b>’, ‘<i>你好。 迅速的!</i>’], ‘tl’: ‘zh’}
Please help!

Note: I"m using the API with python script to translate. What did i do wrong?

Rapid account: Haizibinbin Owynt Kc 0 A 48
haizibinbin-owyntKc0a48 Commented לפני שנה

try this code:

import requests

url = “https://ai-translate.p.rapidapi.com/translates

payload = {
“texts”: [’<a href=“aaaaa.html”>i love code <span>are you?</span> yes<b>i am</b></a>’, “<b>hello. google!</b>”, “<i>hello. rapidapi!</i>”],
“tls”: [“zh”, “ru”],
“sl”: “en”
}
headers = {
“content-type”: “application/json”,
“X-RapidAPI-Key”: “YOUR-API-KEY”,
“X-RapidAPI-Host”: “ai-translate.p.rapidapi.com
}

response = requests.request(“POST”, url, json=payload, headers=headers)

print(response.text)

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입