1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-11-15 04:00:11 +01:00
LibreTranslate/scripts/healthcheck.py
2023-07-09 12:29:11 +02:00

13 lines
317 B
Python

import requests
response = requests.post(
url='http://0.0.0.0:5000/translate',
headers={'Content-Type': 'application/json'},
json={
'q': 'Hello World!',
'source': 'en',
'target': 'en'
}
)
# if server unavailable then requests with raise exception and healthcheck will fail