1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-11-15 12:00:33 +01:00
LibreTranslate/scripts/healthcheck.py
2024-03-06 10:37:47 +01:00

14 lines
331 B
Python

import requests
response = requests.post(
url='http://[::1]: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