Background
At work, we just began to use (or experiment with) Todoist to keep track of log files we need to collect from sites. Todoist is a task management tool that is available on mobile, desktop and web platforms.
Motivation
I wanted to see if I can manipulate the tasks from scripts. I'm using yowsup to develop a Whatsapp bot so I was wondering if I can somehow get the bot to interact with the tasks (such as create new tasks, mark them as complete, etc). At a casual look, the script needs to use OAuth 2.0 token before it can interact with the tasks. Since I do not know anything about the OAuth 2.0 token, here's what I've done to get started.
Steps
Install pytodoist
pip install pytodoist
Get Google OAuth 2.0 Token
I don't know anything about OAuth 2.0 token. I definitely need to learn more about it later, but I found Google OAuth 2.0 Playground, where you can get a working token.
- Choose Google OAuth2 API v2
- Select https://www.googleapis.com/auth/userinfo.email and click Authorize APIs button
- Click Accept when Google OAuth 2.0 Playground requests to have offline access
- You will be given an authorization code. Click Exchange authorization code for tokens
- You will receive refresh and access tokens (If you do not see them, click Step 2 to reveal the tokens)
- Copy the access token
Login with Your OAuth 2.0 Token
from pytodoist import todoist
user = todoist.login_with_google('your-gmail-address', 'your-access-token')
print user.full_name
print user.is_logged_in()