LibreTranslate/scripts/healthcheck.py

14 lines
331 B
Python
Raw Normal View History

import requests
2023-07-09 10:29:11 +00:00
response = requests.post(
2024-03-06 09:37:47 +00:00
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