fast-csv-middleware

A CSV Middleware for FastAPI


Keywords
fastapi, csv, middleware
License
Other
Install
pip install fast-csv-middleware==0.1.3

Documentation

FastAPI CSV Middleware

This is a simple middleware for FastAPI that allows you to upload CSV files and parse them into a list of dictionaries.

I've explained a bit more in this blog post here.

Installation

pip install fast-csv-middleware

Usage

from fastapi import FastAPI
from fastapicsv import CSVMiddleware

app = FastAPI()

app.add_middleware(CSVMiddleware)

Testing

Request Body

Use Content-Type=text/csv in request headers when sending csv text in request body.

Response Body

Use Accept=text/csv in request headers to receive csv text in response body.