ToDus client for the command line and API to use in your Python projects.
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: 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.
This is an example of how you would use this library in your projects:
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")