Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Latest commit

 

History

History
51 lines (37 loc) · 1.15 KB

README.md

File metadata and controls

51 lines (37 loc) · 1.15 KB

Bonnette

THIS PROJECT IS UNMAINTAINED

Use the official ASGI support instead: https://github.com/Azure/azure-functions-python-library.

ASGI adapter for Azure Functions.

Package version Build Status

Requirements: Python 3.6

Installation

pip3 install bonnette

Example

import logging
import azure.functions as func
from bonnette import Bonnette


async def app(scope, receive, send):
    assert scope["type"] == "http"
    await send(
        {
            "type": "http.response.start",
            "status": 200,
            "headers": [[b"content-type", b"text/html; charset=utf-8"]],
        }
    )
    await send(
        {"type": "http.response.body", "body": b"<html><h1>Hello, world!</h1></html>"}
    )


def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info("Python HTTP trigger function processed a request.")
    handler = Bonnette(app)
    return handler(req)