WsgiMiddleware Class
This middleware is to adapt a WSGI supported Python server framework into Azure Functions. It can be used by either calling the .handle() function or exposing the .main property in a HttpTrigger.
Instantiate a WSGI middleware to convert Azure Functions HTTP request into WSGI Python object. Example on handling WSGI app in a HTTP trigger by overwriting the .main() method:
import azure.functions as func
from FlaskApp import app
main = func.WsgiMiddleware(app.wsgi_app).main
Constructor
WsgiMiddleware(app)
Parameters
Name | Description |
---|---|
app
Required
|
|
Methods
handle |
Method to convert an Azure Functions HTTP request into a WSGI Python object. Example on handling WSGI app in a HTTP trigger by calling .handle() in .main() method: import azure.functions as func from FlaskApp import app def main(req, context): return func.WsgiMiddleware(app.wsgi_app).handle(req, context) |
handle
Method to convert an Azure Functions HTTP request into a WSGI Python object. Example on handling WSGI app in a HTTP trigger by calling .handle() in .main() method:
import azure.functions as func
from FlaskApp import app
def main(req, context): return func.WsgiMiddleware(app.wsgi_app).handle(req, context)
handle(req: HttpRequest, context: Context | None = None)
Parameters
Name | Description |
---|---|
req
Required
|
|
context
Required
|
Default value: None
|
Azure SDK for Python