WsgiHttpIncoming

Classin wsgifastly-compute 0.1.3View source

Extends HttpIncoming.

HTTP request handler that serves WSGI applications.

This class provides a convenient base class for serving WSGI applications on Fastly Compute. Instantiate this, and pass in your application.

1
2
3
4
5
6
7
8
9
10
from flask import Flask
from fastly_compute.wsgi import WsgiHttpIncoming
app = Flask(__name__)
@app.route("/hello")
def hello():
return "Hello, World!"
HttpIncoming = WsgiHttpIncoming(app)

Constructor

WsgiHttpIncoming(wsgi_app: Callable, handle_errors: bool = False, reuse_sandboxes_for_ms: int = 0)

Construct.

Parameters

wsgi_app: Callable

The WSGI app to which to delegate requests

handle_errors: booloptional = False

If True, log any raised exception and return a 500-status response.

reuse_sandboxes_for_ms: intoptional = 0

If non-0, keep the sandbox alive for this many milliseconds to potentially serve additional requests.

Methods

__call__

View source
__call__()

Return self to make the instance callable.

This method makes the instance callable, which is required by the WSGI specification. WSGI expects the application to be a callable that returns itself when invoked without arguments.

handle(request: http_req.Request, body: async_io.Pollable) -> None

Handle incoming HTTP requests by serving them through the WSGI app.

Parameters

request: http_req.Request
body: async_io.Pollable

Returns

None