Metadata-Version: 2.1
Name: tuspy
Version: 0.2.5
Summary: A Python client for the tus resumable upload protocol ->  http://tus.io
Home-page: http://github.com/tus/tus-py-client/
Author: Ifedapo Olarewaju
Author-email: ifedapoolarewaju@gmail.com
License: MIT
Platform: any
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: File Transfer Protocol (FTP)
Classifier: Topic :: Communications :: File Sharing
Description-Content-Type: text/markdown
Requires-Dist: future (>=0.16.0)
Requires-Dist: requests (>=2.18.4)
Requires-Dist: six (>=1.11.0)
Requires-Dist: tinydb (>=3.5.0)
Requires-Dist: certifi (>=2018.1.18)
Provides-Extra: dev
Requires-Dist: tox (>=2.3.1) ; extra == 'dev'
Requires-Dist: sphinx-autobuild (==0.7.1) ; extra == 'dev'
Requires-Dist: Sphinx (==1.7.1) ; extra == 'dev'
Provides-Extra: test
Requires-Dist: responses (>=0.5.1) ; extra == 'test'
Requires-Dist: mock (>=2.0.0) ; extra == 'test'
Requires-Dist: coverage (>=4.2) ; extra == 'test'
Requires-Dist: pytest (>=3.0.3) ; extra == 'test'
Requires-Dist: pytest-cov (<2.6,>=2.3.1) ; extra == 'test'

# tus-py-client [![Build Status](https://travis-ci.org/tus/tus-py-client.svg?branch=master)](https://travis-ci.org/tus/tus-py-client)

> **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://master.tus.io/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')
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://master.tus.io/files/abcdef123456',
                       chunk_size=200)
```

## License

MIT


