mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-16 12:30:11 +01:00
14 lines
335 B
Python
14 lines
335 B
Python
import requests
|
|
|
|
response = requests.post(
|
|
url='http://localhost:5000/translate',
|
|
headers={'Content-Type': 'application/json'},
|
|
json={
|
|
'q': 'Hello World!',
|
|
'source': 'en',
|
|
'target': 'en'
|
|
},
|
|
timeout=60
|
|
)
|
|
# if server unavailable then requests with raise exception and healthcheck will fail
|