mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2026-05-27 01:12:29 -04:00
Use health endpoint in check health
This commit is contained in:
@@ -2,14 +2,10 @@ import requests
|
||||
import os
|
||||
|
||||
port = os.environ.get('LT_PORT', '5000')
|
||||
response = requests.post(
|
||||
url=f'http://localhost:{port}/translate',
|
||||
response = requests.get(
|
||||
url=f'http://localhost:{port}/health',
|
||||
headers={'Content-Type': 'application/json'},
|
||||
json={
|
||||
'q': 'Hello World!',
|
||||
'source': 'en',
|
||||
'target': 'en'
|
||||
},
|
||||
json={},
|
||||
timeout=60
|
||||
)
|
||||
response.raise_for_status() # if server unavailable then requests with raise exception and healthcheck will fail
|
||||
|
||||
Reference in New Issue
Block a user