mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-12-27 07:10:26 -05:00
16 lines
397 B
Python
16 lines
397 B
Python
import requests
|
|
import os
|
|
import sys
|
|
|
|
if os.path.isfile('/tmp/booting.flag'):
|
|
sys.exit(0)
|
|
|
|
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
|