https://github.com/oleksis/todus
ToDus client for S3
https://github.com/oleksis/todus
client s3-storage todus
Last synced: 5 months ago
JSON representation
ToDus client for S3
- Host: GitHub
- URL: https://github.com/oleksis/todus
- Owner: oleksis
- License: mpl-2.0
- Fork: true (adbenitez/todus)
- Created: 2021-07-05T21:46:01.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-20T04:13:00.000Z (almost 5 years ago)
- Last Synced: 2024-08-10T05:06:35.822Z (almost 2 years ago)
- Topics: client, s3-storage, todus
- Language: Python
- Homepage: https://oleksis.github.io/todus/
- Size: 333 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
ToDus client
============
.. image:: https://img.shields.io/pypi/v/todus.svg
:target: https://pypi.org/project/todus
.. image:: https://img.shields.io/pypi/pyversions/todus.svg
:target: https://pypi.org/project/todus
.. image:: https://pepy.tech/badge/todus
:target: https://pepy.tech/project/todus
.. image:: https://img.shields.io/pypi/l/todus.svg
:target: https://pypi.org/project/todus
.. image:: https://github.com/adbenitez/todus/actions/workflows/python-ci.yml/badge.svg
:target: https://github.com/adbenitez/todus/actions/workflows/python-ci.yml
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
ToDus client for the command line and API to use in your Python projects.
Install
-------
To install the latest stable version run::
pip install -U todus
To install the latest stable version and enable the 7z multivolume feature for split uploads::
pip install -U 'todus[7z]'
To test the unreleased version run::
pip install todus git+https://github.com/adbenitez/todus
Usage
-----
::
usage: todus [-h] [-n PHONE-NUMBER] [-v] {login,upload,download,token,accounts} ...
ToDus Client
positional arguments:
{login,upload,download,token,accounts}
login authenticate in server
upload upload file
download download file
token get a token
accounts list accounts
optional arguments:
-h, --help show this help message and exit
-n PHONE-NUMBER, --number PHONE-NUMBER
account's phone number, if not given the default account will be used
-v, --version show program's version number and exit.
Developer Quickstart
--------------------
This is an example of how you would use this library in your projects:
.. code-block:: python
from todus.client import ToDusClient2
client = ToDusClient2(phone_number="5312345678")
# this only needs to be done once:
client.request_code() # request SMS to start a new session
pin = input("Enter PIN:").strip() # enter the PIN received in SMS
client.validate_code(pin)
# you must save your session's password to avoid having to verify via SMS again.
print(f"Save your password: {client.password}")
# you need to login to upload/download files:
client.login()
# uploading a file:
file_path = "/home/user/Pictures/photo.jpg"
with open(file_path, "rb") as file:
data = file.read()
url = client.upload_file(data)
print(f"Uploaded file to: {url}")
# downloading a file:
size = client.download_file(url, path="my-photo.jpg")
print(f"Downloaded {size:,} Bytes")