tuspy-1.1.0
توضیحات
A Python client for the tus resumable upload protocol -> http://tus.io
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | tuspy-1.1.0 |
| نام | tuspy |
| نسخه کتابخانه | 1.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Ifedapo Olarewaju |
| ایمیل نویسنده | ifedapoolarewaju@gmail.com |
| آدرس صفحه اصلی | http://github.com/tus/tus-py-client/ |
| آدرس اینترنتی | https://pypi.org/project/tuspy/ |
| مجوز | MIT |
# tus-py-client [](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
نیازمندی
| مقدار | نام |
|---|---|
| - | requests>=2.18.4 |
| - | tinydb>=3.5.0 |
| - | aiohttp>=3.6.2 |
| xtr | responses>=0.5.1; |
| xtr | aioresponses>=0.6.2; |
| xtr | coverage>=4.2; |
| xtr | pytest>=3.0.3; |
| xtr | pytest-cov<2.6,>=2.3.1; |
| xtr | parametrize>=0.1.1; |
| xtr | tox>=2.3.1; |
| xtr | sphinx-autobuild==2021.3.14; |
| xtr | Sphinx==1.7.1; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.5.3 | Python |
نحوه نصب
نصب پکیج whl tuspy-1.1.0:
pip install tuspy-1.1.0.whl
نصب پکیج tar.gz tuspy-1.1.0:
pip install tuspy-1.1.0.tar.gz