AI Translate

GRATIS CON POSSIBILITÀ DI UPGRADE
Da binbin he | Aggiornamento 5 दिन पहले | Translation
Popolarità

9.8 / 10

Latenza

738ms

Livello di servizio

100%

Health Check

100%

Torna a tutte le discussioni

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)

Partecipa alla discussione - aggiungi un commento di seguito:

Accedi/Iscriviti per pubblicare nuovi commenti