Skip to main content

用于 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

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.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

fastzdp_upload-0.1.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file fastzdp_upload-0.1.3.tar.gz.

File metadata

  • Download URL: fastzdp_upload-0.1.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10

File hashes

Hashes for fastzdp_upload-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d86fc04546fdefe9c5734b16272cc6649261d404d1bd55932a9d2e216b87f57d
MD5 e01a795de2558a07d8c819b299a44f31
BLAKE2b-256 d14a583f2820fe110ced45818edf7f867429b3804e6cd1db03b8ce709b352587

See more details on using hashes here.

File details

Details for the file fastzdp_upload-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fastzdp_upload-0.1.3-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.11.7 Windows/10

File hashes

Hashes for fastzdp_upload-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 26a248ef73b0c0746b1dcec6b9104fdefc0aabcf1945df74d6c4dcd5fac0c09d
MD5 84818c9fac6bb5d000bbf62fb96de318
BLAKE2b-256 eb52dcf7e2acdbe04ce17ad63ccb533f2a4b74c1b5786483fe495d0330ce8f85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page