Metadata-Version: 2.1
Name: tuspyserver
Version: 1.2.0
Summary: TUS py protocol implementation in FastAPI
Home-page: https://github.com/edihasaj/tuspy-fast-api
Author: Edi Hasaj
Author-email: edihasaj@outlook.com
License: MIT
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
License-File: LICENSE

# FastAPI Tus

FastAPI Extension implementing the Tus.io server protocol

### Prerequisites `FastAPI`

## Installation

Installation from PyPi repository (recommended for latest stable release)

```
pip install tuspyserver
```

## Usage

### main.py

```python
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from starlette.staticfiles import StaticFiles

from tusserver.tus import create_api_router

app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=['*'],
    allow_methods=["*"],
    allow_headers=["*"],
)
app.mount("/static", StaticFiles(directory="static"), name="static")


def on_upload_complete(file_path: str):
    print('Upload complete')
    print(file_path)


app.include_router(
    create_api_router(
        files_dir='/tmp/different_dir', # OPTIONAL
        location='http://127.0.0.1:8000/files', # OPTIONAL
        max_size=128849018880, # OPTIONAL
        on_upload_complete=on_upload_complete # OPTIONAL
    ),
    prefix="/files"
)
```

This package has the ability to upload, download, delete (including a scheduler) files.

```python setup.py sdist bdist_wheel```

Any contribution is welcomed.

<a href="https://www.buymeacoffee.com/edihasaj" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
