Skip to main content

A package to return the health status of a flask application

Project description


pip3.7 install --user FlaskHealthCheck #use whatever pip version you have, but this is built for python3+


This package relies on a couple of things:

  1. Your Flask application has a file called 'appversion.txt' in its root directory with a line at the top that looks like:
    version: x.x.x (check the flask-template for clarification)

  2. You've got Python 3+ installed as well as Flask and all of your necessary dependencies (obviously, including the package we install here)


Within your routes file that will contain the health check endpoint do the following:

import FlaskHealthCheck

#Add your endpoint like so:
@swag_from('../swags/healthcheck/healthcheck.yml') #or wherever your swagger file may be for this endpoint
def health_check():
    return jsonify(FlaskHealthCheck.healthcheck())

Example Return Value

When the endpoint is called from your API, an expected 200 response would look like the following:

  "HealthCheckResponse": {
    "AppVersion": "1.0.0",                  //The app version
    "Config": {     
      "CurDir": "/opt/apps/MyWebAPI",       //Root directory of your API
      "IsSuccess": "true",                  //API is reachable (this is a 'to-be-configured' state)
      "MachineName": "MyMachineName",       //The hostname of the box it's being run on
      "PyVersion": "3.7.0 (default, Sep 24 2018, 12:47:32) \n[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]",
      "Uptime": 126.47574424743652,         //How long (in seconds) the service has been up for
      "User": "WebAPIUser"                  //The user which is running the service

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_otpp_healthcheck-0.0.4.tar.gz (2.5 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page