Skip to content

tus.io protocol implementation for aiohttp.web applications

License

Notifications You must be signed in to change notification settings

okumy/aiohttp-tus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d3a9264 · Jan 4, 2022

History

58 Commits
Jul 14, 2020
Jan 4, 2022
Oct 24, 2021
Mar 20, 2020
Apr 2, 2020
Mar 11, 2020
Mar 11, 2020
Jun 8, 2020
Jul 13, 2020
Jan 4, 2022
Jan 4, 2022
Jan 4, 2022
Jul 31, 2020
Jul 14, 2020
May 17, 2020
Mar 15, 2020
Jan 4, 2022
Jul 14, 2020
Jan 4, 2022

Repository files navigation

aiohttp-tus

CI Workflow pre-commit black Latest Version Python versions BSD License Documentation

tus.io server implementation for aiohttp.web applications.

For uploading large files, please consider using aiotus (Python 3.7+) library instead.

  • Works on Python 3.6+
  • Works with aiohttp 3.5+
  • BSD licensed
  • Latest documentation on Read The Docs
  • Source, issues, and pull requests on GitHub

Quickstart

Code belows shows how to enable tus-compatible uploads on /uploads URL for aiohttp.web application. After upload, files will be available at ../uploads directory.

from pathlib import Path

from aiohttp import web
from aiohttp_tus import setup_tus


app = setup_tus(
    web.Application(),
    upload_url="/uploads",
    upload_path=Path(__file__).parent.parent / "uploads",
)

Chunk Size

Please, make sure to configure client_max_size for aiohttp.web Application and supply proper chunkSize for Uppy.io or other tus.io client.

Documentation

CORS Headers

To setup CORS headers you need to use cors_middleware from aiohttp-middlewares package. aiohttp-cors library not supported cause of aio-libs/aiohttp-cors#241 issue.

Documentation

Reverse proxy and HTTPS

When aiohttp application deployed under the reverse proxy (such as nginx) with HTTPS support, it is needed to use https_middleware from aiohttp-middlewares package to ensure that web.Request instance has proper schema.

Documentation

Examples

examples/ directory contains several examples, which illustrate how to use aiohttp-tus with some tus.io clients, such as tus.py and Uppy.io.