Metadata-Version: 2.1
Name: bacinet
Version: 0.0.1
Summary: Setting up security-relevant response headers in FastAPI
Home-page: https://github.com/hbel/bacinet
Author: Hendrik Belitz
Author-email: hendrik@hendrikbelitz.de
Project-URL: Homepage, https://github.com/hbel/bacinet
Keywords: FastAPI headers http
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi

# bacinet

Helmet-like http response Headers for FastAPI.

_This is alpha software lacking testing and proper documentation. Use at your own risk!_

## Basic usage

Install package via `pip install bacinet`.

In your code, import apply from the package and add it as a middleware to your app:

```python
from bacinet import apply
from fastapi import FastAPI, Request

app = FastAPI()


@app.middleware("http")
async def add_bacinet(request: Request, call_next):
    response = await call_next(request)
    apply(response)
    return response
```

To change the default options, import and change the options dictionary from bacinet:

```python
from bacinet import options

options["X-DNS-Prefetch-Control"] = "on"
```

You can also import individual header functions (like `x_download_options`) and apply those.
