tuspy


Nametuspy JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttp://github.com/tus/tus-py-client/
SummaryA Python client for the tus resumable upload protocol -> http://tus.io
upload_time2024-11-29 11:43:55
maintainerNone
docs_urlNone
authorIfedapo Olarewaju
requires_python>=3.5.3
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tus-py-client [![Build Status](https://github.com/tus/tus-py-client/actions/workflows/CI.yml/badge.svg)](https://github.com/tus/tus-py-client/actions/workflows/CI.yml)

> **tus** is a protocol based on HTTP for _resumable file uploads_. Resumable
> means that an upload can be interrupted at any moment and can be resumed without
> re-uploading the previous data again. An interruption may happen willingly, if
> the user wants to pause, or by accident in case of a network issue or server
> outage.

**tus-py-client** is a Python client for uploading files using the _tus_ protocol to any remote server supporting it.

## Documentation

See documentation here: http://tus-py-client.readthedocs.io/en/latest/

## Get started

```bash
pip install tuspy
```

Now you are ready to use the api.

```python
from tusclient import client

# Set Authorization headers if it is required
# by the tus server.
my_client = client.TusClient('http://tusd.tusdemo.net/files/',
                              headers={'Authorization': 'Basic xxyyZZAAbbCC='})

# Set more headers.
my_client.set_headers({'HEADER_NAME': 'HEADER_VALUE'})

uploader = my_client.uploader('path/to/file.ext', chunk_size=200)

# A file stream may also be passed in place of a file path.
fs = open('path/to/file.ext', mode=)
uploader = my_client.uploader(file_stream=fs, chunk_size=200)

# Upload a chunk i.e 200 bytes.
uploader.upload_chunk()

# Uploads the entire file.
# This uploads chunk by chunk.
uploader.upload()

# you could increase the chunk size to reduce the
# number of upload_chunk cycles.
uploader.chunk_size = 800
uploader.upload()

# Continue uploading chunks till total chunks uploaded reaches 1000 bytes.
uploader.upload(stop_at=1000)
```

If the upload url is known and the client headers are not required, uploaders can also be used standalone.

```python
from tusclient.uploader import Uploader

my_uploader = Uploader('path/to/file.ext',
                       url='http://tusd.tusdemo.net/files/abcdef123456',
                       chunk_size=200)
```

## Development

If you want to work on tus-py-client internally, follow these few steps:

1. Setup virtual environment and install dependencies

   ```bash
   python -m venv env/
   source env/bin/activate
   pip install -e .[test]
   ```

2. Running tests

   ```bash
   pytest
   ```

3. Releasing a new version (see https://realpython.com/pypi-publish-python-package/)

   ```bash
   # Update version in tusclient/__init__.py
   vim tusclient/__init__.py

   # Update changelogs
   vim CHANGELOG.md

   pytest

   # Commit and tag
   git commit -m 'v1.2.3'
   git tag v1.2.3

   # Build and release
   pip install build twine
   python -m build
   twine check dist/*
   twine upload dist/*

   # Then: make release on GitHub
   ```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/tus/tus-py-client/",
    "name": "tuspy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5.3",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ifedapo Olarewaju",
    "author_email": "ifedapoolarewaju@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/11/21/706996ed872ecb6881dec3708cfbc6a3f92026e9e62acc9fcc4bc1019f2d/tuspy-1.1.0.tar.gz",
    "platform": "any",
    "description": "# tus-py-client [![Build Status](https://github.com/tus/tus-py-client/actions/workflows/CI.yml/badge.svg)](https://github.com/tus/tus-py-client/actions/workflows/CI.yml)\n\n> **tus** is a protocol based on HTTP for _resumable file uploads_. Resumable\n> means that an upload can be interrupted at any moment and can be resumed without\n> re-uploading the previous data again. An interruption may happen willingly, if\n> the user wants to pause, or by accident in case of a network issue or server\n> outage.\n\n**tus-py-client** is a Python client for uploading files using the _tus_ protocol to any remote server supporting it.\n\n## Documentation\n\nSee documentation here: http://tus-py-client.readthedocs.io/en/latest/\n\n## Get started\n\n```bash\npip install tuspy\n```\n\nNow you are ready to use the api.\n\n```python\nfrom tusclient import client\n\n# Set Authorization headers if it is required\n# by the tus server.\nmy_client = client.TusClient('http://tusd.tusdemo.net/files/',\n                              headers={'Authorization': 'Basic xxyyZZAAbbCC='})\n\n# Set more headers.\nmy_client.set_headers({'HEADER_NAME': 'HEADER_VALUE'})\n\nuploader = my_client.uploader('path/to/file.ext', chunk_size=200)\n\n# A file stream may also be passed in place of a file path.\nfs = open('path/to/file.ext', mode=)\nuploader = my_client.uploader(file_stream=fs, chunk_size=200)\n\n# Upload a chunk i.e 200 bytes.\nuploader.upload_chunk()\n\n# Uploads the entire file.\n# This uploads chunk by chunk.\nuploader.upload()\n\n# you could increase the chunk size to reduce the\n# number of upload_chunk cycles.\nuploader.chunk_size = 800\nuploader.upload()\n\n# Continue uploading chunks till total chunks uploaded reaches 1000 bytes.\nuploader.upload(stop_at=1000)\n```\n\nIf the upload url is known and the client headers are not required, uploaders can also be used standalone.\n\n```python\nfrom tusclient.uploader import Uploader\n\nmy_uploader = Uploader('path/to/file.ext',\n                       url='http://tusd.tusdemo.net/files/abcdef123456',\n                       chunk_size=200)\n```\n\n## Development\n\nIf you want to work on tus-py-client internally, follow these few steps:\n\n1. Setup virtual environment and install dependencies\n\n   ```bash\n   python -m venv env/\n   source env/bin/activate\n   pip install -e .[test]\n   ```\n\n2. Running tests\n\n   ```bash\n   pytest\n   ```\n\n3. Releasing a new version (see https://realpython.com/pypi-publish-python-package/)\n\n   ```bash\n   # Update version in tusclient/__init__.py\n   vim tusclient/__init__.py\n\n   # Update changelogs\n   vim CHANGELOG.md\n\n   pytest\n\n   # Commit and tag\n   git commit -m 'v1.2.3'\n   git tag v1.2.3\n\n   # Build and release\n   pip install build twine\n   python -m build\n   twine check dist/*\n   twine upload dist/*\n\n   # Then: make release on GitHub\n   ```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python client for the tus resumable upload protocol ->  http://tus.io",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "http://github.com/tus/tus-py-client/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "328eb94ec25fcd4384de2a1f5e0403284f005ec743c04bafdb6698c851df5c6d",
                "md5": "814f438686a492e912ab14229bdc8bda",
                "sha256": "7fc5ac8fb25de37c96c90213f83a1ffdede7f48a471cb5a15a2f57846828a79a"
            },
            "downloads": -1,
            "filename": "tuspy-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "814f438686a492e912ab14229bdc8bda",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5.3",
            "size": 15319,
            "upload_time": "2024-11-29T11:43:47",
            "upload_time_iso_8601": "2024-11-29T11:43:47.072026Z",
            "url": "https://files.pythonhosted.org/packages/32/8e/b94ec25fcd4384de2a1f5e0403284f005ec743c04bafdb6698c851df5c6d/tuspy-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1121706996ed872ecb6881dec3708cfbc6a3f92026e9e62acc9fcc4bc1019f2d",
                "md5": "089d802ced979627a8f3fa6f801adcc8",
                "sha256": "156734eac5c61a046cfecd70f14119f05be92cce198eb5a1a99a664482bedb89"
            },
            "downloads": -1,
            "filename": "tuspy-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "089d802ced979627a8f3fa6f801adcc8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5.3",
            "size": 16949,
            "upload_time": "2024-11-29T11:43:55",
            "upload_time_iso_8601": "2024-11-29T11:43:55.778814Z",
            "url": "https://files.pythonhosted.org/packages/11/21/706996ed872ecb6881dec3708cfbc6a3f92026e9e62acc9fcc4bc1019f2d/tuspy-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-29 11:43:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tus",
    "github_project": "tus-py-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "tuspy"
}
        
Elapsed time: 0.66652s