From 83282ab47d3ca1e4d7e446d3c21fc7be491f5540 Mon Sep 17 00:00:00 2001 From: Jon Chin Date: Sun, 15 Jan 2023 16:21:13 -0500 Subject: [PATCH] small script for testing if service is ready for requests --- healthcheck.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 healthcheck.py diff --git a/healthcheck.py b/healthcheck.py new file mode 100644 index 0000000..cd62b4f --- /dev/null +++ b/healthcheck.py @@ -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