Ways to stream CSV content.
Project description
stream-csv
Installation
pip install stream-csv
Usage
from fastapi import FastAPI
from starlette.responses import StreamingResponse
from stream_csv.stream import stream_data
app = FastAPI()
@app.get("/")
def get_csv():
headers = ["type", "color", "size"]
dict_data = [
{"type": "potato", "color": "blue", "size": 1},
{"type": "banana", "color": "red", "size": 2},
{"type": "potato", "size": 3, "color": "yellow"},
]
return StreamingResponse(
stream_data(dict_data, headers),
media_type="text/csv",
headers={"Content-Disposition": "attachment; filename=data.csv"},
)
License
This project is licensed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stream-csv-0.1.1.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file stream-csv-0.1.1.tar.gz
.
File metadata
- Download URL: stream-csv-0.1.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-59-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56b8e32554ba8b8acbdca3b6c1150ab69a776dc32b3722520fe9ce66868877ee |
|
MD5 | 3ffaf3041160ccd37acc1f98ff4d23f1 |
|
BLAKE2b-256 | bbe6904a56efa094719c0b4805114e4ea6007ad026e606cd550160f4343a97f5 |
File details
Details for the file stream_csv-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: stream_csv-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-59-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a2d9c819c43473406d53abba16b529acf13fc071023fcbf64485d7a4fe4839b |
|
MD5 | cb55dfd6f4e523b04fb8de4ba9507009 |
|
BLAKE2b-256 | 2b593ffdff3a071dc2db735cdd7908a90b5c863191c0267ea9188d37fe359d72 |