some test changes

This commit is contained in:
2023-08-26 20:41:53 +03:00
parent 21a54e1585
commit f6312f7207
3 changed files with 16 additions and 7 deletions

Binary file not shown.

View File

@@ -1,10 +1,13 @@
#!/usr/bin/pyhton3
import requests
import time
from random import randint
def translate(_input, lang='RU'):
url = "https://www2.deepl.com/jsonrpc"
_id = randint(10000000, 99999999)
r = requests.post(
url,
@@ -29,8 +32,14 @@ def translate(_input, lang='RU'):
"commonJobParams": {},
"timestamp": int(round(time.time() * 1000))
},
"id": 40890009
"id": 40890008
}
)
print(r.json())
return r.json()['result']['translations'][0]['beams'][0]['postprocessed_sentence']
print(_id)
try:
return r.json()['result']['translations'][0]['beams'][0]['postprocessed_sentence']
except:
print(r.json())