Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

```func new``` not creating a valid template with Python #1525

Open lukasmu opened 4 days ago

lukasmu commented 4 days ago

On https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=linux%2Cbash%2Cazure-cli%2Cbrowser#create-a-local-function it is explained that a new function can be created with the command func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous". However, this executing this command generates invalid code. When trying to run func start afterwards, an exception is raised:

Worker failed to index functions
Result: Failure
Exception: AttributeError: anonymous

It appears that the function decorator is not generated correctly: It should be @app.route(route="HttpExample", auth_level=func.AuthLevel.ANONYMOUS) instead of @app.route(route="HttpExample", auth_level=func.AuthLevel.Anonymous).