用于 FastAPI 快速实现文件上传下载功能
Project description
fastzdp_upload
专为FastAPI打造的处理文件上传下载的框架
Github项目开源地址:https://github.com/zhangdapeng520/fastzdp_upload
特性
- 1、伪代码开发
- 2、自动拥有上传文件的接口
- 3、自动拥有下载文件的接口
- 4、自动拥有搜索文件的接口
- 5、自动拥有修改文件名的接口
- 6、自动拥有删除文件的接口
使用教程
安装
pip install fastzdp_upload
快速入门
启动下面的服务以后,浏览器访问接口文档:http://127.0.0.1:8888/docs
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/fastzdp_upload?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=8888)
版本历史
v0.1.3
- 基本功能实现,代码迁移至Github
v0.1.4
- 解决和fastzdp-api依赖冲突的问题
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.4.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file fastzdp_upload-0.1.4.tar.gz
.
File metadata
- Download URL: fastzdp_upload-0.1.4.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d765df543b4020bffb36367e619f1f01856cc45b79a4270ac1ddbcdba074780 |
|
MD5 | 236aaab58be7a08d9d0cf185f1ed0cbe |
|
BLAKE2b-256 | d16acf770769d4be3c18d3bb77d6aab81471e313bb36e0cbfaa1408a9806966d |
File details
Details for the file fastzdp_upload-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: fastzdp_upload-0.1.4-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e3ad3e8f4fe473449c49d0c41281c036ae57c35f80deedaf21598e25348481 |
|
MD5 | 165f65f3e65ffa857fd44ab6bc3251f1 |
|
BLAKE2b-256 | b5036fd2998100e139df9614c0abf9305442338fa75f83d9ab4154841f4c8b60 |