mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 16:01:01 +00:00
small script for testing if service is ready for requests
This commit is contained in:
parent
9da5051ae2
commit
83282ab47d
1 changed files with 11 additions and 0 deletions
11
healthcheck.py
Normal file
11
healthcheck.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
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
|
Loading…
Reference in a new issue