用于 FastAPI 快速实现文件上传下载功能
Project description
fastzdp_upload
FastAPI文件上传下载的组件库。
使用本组件库,你将一行代码轻松拥有如下接口:
- 文件上传
- 文件下载
- 文件删除
- 获取文件列表
安装
pip install fastzdp_upload
使用
import fastzdp_upload
from fastapi import FastAPI
from sqlmodel import SQLModel, Field, create_engine, Session
# 创建数据库引擎
sqlite_url = "mysql+pymysql://root:root@127.0.0.1:3306/test?charset=utf8mb4"
engine = create_engine(sqlite_url, echo=True)
# 确保表存在
SQLModel.metadata.drop_all(engine)
SQLModel.metadata.create_all(engine)
def get_db():
db = Session(engine)
try:
yield db
finally:
db.close()
app = FastAPI()
app.include_router(fastzdp_upload.get_router(get_db))
if __name__ == '__main__':
import uvicorn
uvicorn.run(app, host='0.0.0.0', port=8000)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastzdp_upload-0.1.2.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file fastzdp_upload-0.1.2.tar.gz
.
File metadata
- Download URL: fastzdp_upload-0.1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88609d254101bb5131fc2425e8ca80a9a46f1b1842bffca214d5c2d924d461e9 |
|
MD5 | 03665fb2ef4c522dd5b97febcd4c0f36 |
|
BLAKE2b-256 | 7ad1fedd0d7982f48fbc41c78fa2898221e3b7c1f9a9701ac4980e6b04201705 |
File details
Details for the file fastzdp_upload-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: fastzdp_upload-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c182a38f55e7e52e8cda590599e3c3ab99e4dcdef1c6db67f877db3fc6a7ab7c |
|
MD5 | fd1400ecc0779071d5d2048645a67502 |
|
BLAKE2b-256 | 06758c9727bf5d2a02ce27cc698115e8a8e5c3556ae790d9f2054ff756f821bd |