python-3.xflaskhttp2kubernetes-health-checkquart

Python3 Quart register_blueprint of python-healthz throws exception


I use flask and trying to migrate to quart in order to benefit from HTTP/2. I use flask-healthz for kubernetes readiness and liveness health checks. Is there any quart equivalent of flask-healthz?

I am not sure it would work but trying to register_blueprint(healthz, url_prefix="/health") throws the following exception:

  File "/app/src/app.py", line 37, in create_app
    app.register_blueprint(healthz, url_prefix="/healthz")
  File "/home/user/.local/lib/python3.9/site-packages/quart/app.py", line 507, in register_blueprint
    blueprint.register(
  File "/home/user/.local/lib/python3.9/site-packages/flask/blueprints.py", line 322, in register
    state = self.make_setup_state(app, options, first_registration)
  File "/home/user/.local/lib/python3.9/site-packages/flask/blueprints.py", line 250, in make_setup_state
    return BlueprintSetupState(self, app, options, first_registration)
  File "/home/user/.local/lib/python3.9/site-packages/flask/blueprints.py", line 76, in __init__
    self.url_defaults.update(self.options.get("url_defaults", ()))
TypeError: 'NoneType' object is not iterable

Any advice and insight is appreciated.

https://gitlab.com/pgjones/quart/-/issues/437#


Solution

  • It works with the following fixes: (1) import quart.flask_patch (2) Change the scheme of the health check endpoint to HTTPS