LibreTranslate/scripts/healthcheck.py
2023-01-16 12:16:30 -05:00

12 lines
316 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