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.
Metadata
Release files for stream-csv 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stream-csv-0.1.1.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stream_csv-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / stream-csv-0.1.1.tar.gz
| Download URL | stream-csv-0.1.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56b8e32554ba8b8acbdca3b6c1150ab69a776dc32b3722520fe9ce66868877ee
|
|
BLAKE2b-256 checksum How to use checksums |
bbe6904a56efa094719c0b4805114e4ea6007ad026e606cd550160f4343a97f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-59-generic
|
Release files / stream_csv-0.1.1-py3-none-any.whl
| Download URL | stream_csv-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a2d9c819c43473406d53abba16b529acf13fc071023fcbf64485d7a4fe4839b
|
|
BLAKE2b-256 checksum How to use checksums |
2b593ffdff3a071dc2db735cdd7908a90b5c863191c0267ea9188d37fe359d72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-59-generic
|