Skip to content

Instantly share code, notes, and snippets.

@atemate
Created April 14, 2023 14:27
Show Gist options
  • Save atemate/71a7c6b12fd4d8065fb5d2bba1e8cdb4 to your computer and use it in GitHub Desktop.
Save atemate/71a7c6b12fd4d8065fb5d2bba1e8cdb4 to your computer and use it in GitHub Desktop.
Check http health using python
python -c "import http.client; \
c = http.client.HTTPConnection('localhost:8080'); \
r = c.request('GET', '/health'); \
r = c.getresponse(); \
assert r.status == 200, (r.status, r.reason)"
python -c 'import httpx; r = httpx.get("http://localhost:8080/health"); r.raise_for_status()'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment