jinruiyang commited on
Commit ·
7e6020c
1
Parent(s): f3e982e
Fix DeepL API auth: use header-based authentication
Browse files- backend/api.py +3 -1
backend/api.py
CHANGED
|
@@ -163,8 +163,10 @@ async def translate_with_deepl(texts: List[str], target_lang: str) -> List[str]:
|
|
| 163 |
async with httpx.AsyncClient() as client:
|
| 164 |
response = await client.post(
|
| 165 |
DEEPL_API_URL,
|
|
|
|
|
|
|
|
|
|
| 166 |
data={
|
| 167 |
-
"auth_key": DEEPL_API_KEY,
|
| 168 |
"text": texts_to_translate,
|
| 169 |
"target_lang": deepl_lang,
|
| 170 |
"source_lang": "EN"
|
|
|
|
| 163 |
async with httpx.AsyncClient() as client:
|
| 164 |
response = await client.post(
|
| 165 |
DEEPL_API_URL,
|
| 166 |
+
headers={
|
| 167 |
+
"Authorization": f"DeepL-Auth-Key {DEEPL_API_KEY}"
|
| 168 |
+
},
|
| 169 |
data={
|
|
|
|
| 170 |
"text": texts_to_translate,
|
| 171 |
"target_lang": deepl_lang,
|
| 172 |
"source_lang": "EN"
|