tuspyserver


Nametuspyserver JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://github.com/edihasaj/tuspy-fast-api
SummaryTUS py protocol implementation in FastAPI
upload_time2024-08-28 09:31:55
maintainerNone
docs_urlNone
authorEdi Hasaj
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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, metadata: dict):
    print('Upload complete')
    print(file_path)
    print('Upload Metadata')
    print(metadata)


app.include_router(
    create_api_router(
        files_dir='/tmp/different_dir', # 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>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/edihasaj/tuspy-fast-api",
    "name": "tuspyserver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Edi Hasaj",
    "author_email": "edihasaj@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3b/0d/020fba4a0a6022538983867ac3b6c4de68c4d465e06fc594f7dcb81e0b05/tuspyserver-2.1.0.tar.gz",
    "platform": "any",
    "description": "# FastAPI Tus\n\nFastAPI Extension implementing the Tus.io server protocol\n\n### Prerequisites `FastAPI`\n\n## Installation\n\nInstallation from PyPi repository (recommended for latest stable release)\n\n```\npip install tuspyserver\n```\n\n## Usage\n\n### main.py\n\n```python\nfrom fastapi import FastAPI\nfrom starlette.middleware.cors import CORSMiddleware\nfrom starlette.staticfiles import StaticFiles\n\nfrom tusserver.tus import create_api_router\n\napp = FastAPI()\napp.add_middleware(\n    CORSMiddleware,\n    allow_origins=['*'],\n    allow_methods=[\"*\"],\n    allow_headers=[\"*\"],\n)\napp.mount(\"/static\", StaticFiles(directory=\"static\"), name=\"static\")\n\n\ndef on_upload_complete(file_path: str, metadata: dict):\n    print('Upload complete')\n    print(file_path)\n    print('Upload Metadata')\n    print(metadata)\n\n\napp.include_router(\n    create_api_router(\n        files_dir='/tmp/different_dir', # OPTIONAL\n        max_size=128849018880, # OPTIONAL\n        on_upload_complete=on_upload_complete # OPTIONAL\n        prefix=\"files\"\n    ),\n)\n```\n\nThis package has the ability to upload, download, delete (including a scheduler) files.\n\n```python setup.py sdist bdist_wheel```\n\nAny contribution is welcomed.\n\n<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>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "TUS py protocol implementation in FastAPI",
    "version": "2.1.0",
    "project_urls": {
        "Homepage": "https://github.com/edihasaj/tuspy-fast-api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a5c464a487681f2186bd2fbf38e2cc7821fbe1b17e3dc9103c55b23f47b68c5b",
                "md5": "a971bdb968caced23bf1fd76df3dbb75",
                "sha256": "eae8995384b444119241dfff30c7ced892e3cb69325eb01fd5fafb581dd7611e"
            },
            "downloads": -1,
            "filename": "tuspyserver-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a971bdb968caced23bf1fd76df3dbb75",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6367,
            "upload_time": "2024-08-28T09:31:54",
            "upload_time_iso_8601": "2024-08-28T09:31:54.658704Z",
            "url": "https://files.pythonhosted.org/packages/a5/c4/64a487681f2186bd2fbf38e2cc7821fbe1b17e3dc9103c55b23f47b68c5b/tuspyserver-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b0d020fba4a0a6022538983867ac3b6c4de68c4d465e06fc594f7dcb81e0b05",
                "md5": "277e8cb937001461ec1c0ea96622415c",
                "sha256": "d8a0ed7edf9b8fa95549503a338eb6250f87a5e8063c031da7d4ca79715b9006"
            },
            "downloads": -1,
            "filename": "tuspyserver-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "277e8cb937001461ec1c0ea96622415c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5800,
            "upload_time": "2024-08-28T09:31:55",
            "upload_time_iso_8601": "2024-08-28T09:31:55.860662Z",
            "url": "https://files.pythonhosted.org/packages/3b/0d/020fba4a0a6022538983867ac3b6c4de68c4d465e06fc594f7dcb81e0b05/tuspyserver-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-28 09:31:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "edihasaj",
    "github_project": "tuspy-fast-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "tuspyserver"
}
        
Elapsed time: 0.46757s