A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Azure/azure-functions-python-worker/discussions/1138 below:

V2 Programming Model for Azure Functions using Python (Preview) · Azure/azure-functions-python-worker · Discussion #1138 · GitHub

You can use generic decorators if you need any decorator thats not natively supported by V2 programming model and has an extension available. Hope this helps


@app.function_name(name="default_template")
@app.generic_trigger(arg_name="req",
                     type="httpTrigger",
                     route="default_template")
@app.generic_output_binding(arg_name="$return", type="http")
def default_template(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.params.get('name')
    if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

    if name:
        return func.HttpResponse(
            f"Hello, {name}. This HTTP triggered function "
            f"executed successfully.")
    else:
        return func.HttpResponse(
            "This HTTP triggered function executed successfully. "
            "Pass a name in the query string or in the request body for a"
            " personalized response.",
            status_code=200
        )

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4