Giter Site home page Giter Site logo

todus's Introduction

ToDus client

https://pepy.tech/badge/todus

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:

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")

todus's People

Contributors

adbenitez avatar dependabot[bot] avatar gsg2604 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

todus's Issues

Obtener up/down URLs devuelve vacio

En la funcion todus.s3.reserve_url las variables up_url y down_url devuelven vacio "" cuando se intenta procesar el flujo siguiente de ejemplo:

<iq o='[email protected]/121301275121541378041087539204' t='result' i='iJELc-3'><query xmlns='todus:purl' put='' get='' status='500'/></iq><r xmlns='x7'/>

Nota: Pasando un teléfono y token válido para Autenticación

400 Client Error en request_code()

Ante todo gracias, y muy buen trabajo!!

Estoy recibiendo un error al intentar utilizar la función request_code() de la siguiente manera:

todus_client = client.ToDusClient()
todus_client.request_code('+53xxxxxxxx')

Estoy asumiendo que el orden de ejecucuón sería request_code(), validate_code y login(), y el error que recibo es:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://auth.todus.cu/v2/auth/users.reserve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.