---
title: WsgiHttpIncoming
summary: HTTP request handler that serves WSGI applications.
url: https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/wsgi/class.WsgiHttpIncoming/
---

**Kind:** Class  
**Module:** [wsgi](https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/wsgi/)  
**Package:** fastly-compute 0.1.3  
**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/wsgi.py#L159

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.

```python
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

**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/wsgi.py#L179

```python
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`: `bool` (optional) = `False`

  If True, log any raised exception and return a
  500-status response.
- `reuse_sandboxes_for_ms`: `int` (optional) = `0`

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

## Methods

### __call__

**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/wsgi.py#L197

```python
__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

**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/wsgi.py#L206

```python
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`
