Python3 Quart register_blueprint of python-healthz 抛出异常

Python3 Quart register_blueprint of python-healthz throws exception

我使用 flask 并尝试迁移到 quart 以便从 HTTP/2 中受益。我使用 flask-healthz 进行 kubernetes 就绪性和活性健康检查。是否有 quart 等同于 flask-healthz

我不确定它是否有效,但尝试 register_blueprint(healthz, url_prefix="/health") 会引发以下异常:

  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

欢迎任何建议和见解。

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

它适用于以下修复: (1) import quart.flask_patch (2)将健康检查端点的scheme改为HTTPS