Skip to main content

Python wrapper for the Toodledo v3 API which is documented at http://api.toodledo.com/3/

Project description

Overview

Python wrapper for the Toodledo v3 API which is documented at http://api.toodledo.com/3/. Available on PyPI at https://pypi-hypernode.com/project/toodledo/.

This fork is being actively maintained by Jonathan Kamens <jik@kamens.us>. Thanks to Rehan Khwaja for creating this library.

Usage

If you’re using this library to build a web app that will be used by multiple people, you need to be familiar with how to use OAuth2 for authentication between your web app and Toodledo. Explaining how to do that is beyond the scope of this document.

To use the library, you need to register an app in your Toodledo account. This can be done at https://api.toodledo.com/3/account/doc_register.php. You will need the client ID and client secret for your app shown on the registration page to connect to the API.

If you’re using this library to build a private script you’re running yourself, you will probably want to use the CommandLineAuthorization function in the library to authenticate the first time. Something like this:

import os
from toodledo import TokenStorageFile, CommandLineAuthorization

tokenFilePath = "fill in path to token file"
clientId = "fill in your app client ID"
clientSecret = "fill in your app client secret"
scope = "basic tasks notes folders write"
tokenStorage = TokenStorageFile(tokenFilePath)

if not os.path.exists(tokenFilePath):
    CommandLineAuthorization(clientId, clientSecret, scope, tokenStorage)

It will prompt you to visit a URL, which will prompt you to log into Toodledo if you’re not already logged in, then click a “SIGN IN” button. The sign in will fail since you presumably specified a bogus redirect URL when registering the app, but you can then copy the failed URL from your browser back into the script to complete the authentication process.

Once you’ve authenticated, you create an API instance like this:

toodledo = Toodledo(
  clientId=clientId,
  clientSecret=clientSecret,
  tokenStorage=tokenStorage,
  scope=scope)

And here’s how you call the API:

account = toodledo.GetAccount()

allTasks = toodledo.GetTasks(params={})

See this more extensive example of using the API in a script.

Developing the library

The library uses poetry for managing packages, building, and publishing. You can do poetry install at the top level of the source tree to install all of the needed dependencies to build and run the library. poetry build builds packages, and poetry publish publishes them to PyPI.

All the code in the library is both pylint and flake8 clean, and any PRs that are submitted should maintain that. Run pylint *.py tests toodledo and flake8 to check everything.

To run the tests, set the following environment variables:

Then generate the credentials json file by running

python generate-credentials.py

Then run the tests by executing

pytest

in the root directory.

Please ensure that all the tests pass in any PRs you submit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toodledo-1.2.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

toodledo-1.2.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file toodledo-1.2.0.tar.gz.

File metadata

  • Download URL: toodledo-1.2.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.19.0-23-generic

File hashes

Hashes for toodledo-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8d2943cf2dfaeb17ba405a5d97b4a5346f1f29ca27e1df26a69aeb0bbd6b9ef0
MD5 d8420cd979abcb0d9a38405522be5ae7
BLAKE2b-256 9c9fae73c9dc4f8fcacc88ec2ef165cfffca6c09a0a56888a0109d77eed3286f

See more details on using hashes here.

File details

Details for the file toodledo-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: toodledo-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.19.0-23-generic

File hashes

Hashes for toodledo-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e264ca190b067f29a27fe661761586dbf9ec3ba6bf4ba84836e0e9c9d56e2409
MD5 bf6e8895867534b2effe2d91338f1e9e
BLAKE2b-256 4ffd5b3ea72fa747f3c0eb7315032f0c5c3fc473632b182952a430637c395f71

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page