LibreTranslate/scripts/healthcheck.py
2025-12-04 00:49:31 -05:00

12 lines
329 B
Python

import requests
import os
port = os.environ.get('LT_PORT', '5000')
response = requests.get(
url=f'http://localhost:{port}/health',
headers={'Content-Type': 'application/json'},
json={},
timeout=60
)
response.raise_for_status() # if server unavailable then requests with raise exception and healthcheck will fail