azure函数的asgi适配器
bonnette的Python项目详细描述
邦奈特
azure函数的asgi适配器。
需求:python 3.6
安装
pip3 install bonnette
示例
importloggingimportazure.functionsasfuncfrombonnetteimportBonnetteasyncdefapp(scope,receive,send):assertscope["type"]=="http"awaitsend({"type":"http.response.start","status":200,"headers":[[b"content-type",b"text/html; charset=utf-8"]],})awaitsend({"type":"http.response.body","body":b"<html><h1>Hello, world!</h1></html>"})defmain(req:func.HttpRequest)->func.HttpResponse:logging.info("Python HTTP trigger function processed a request.")handler=Bonnette(app)returnhandler(req)