diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6dd6a3d --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# Created by .gitignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IDEA +.idea/ \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..1b951d1 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +nextaction: python nextaction.py \ No newline at end of file diff --git a/README.md b/README.md index 32f8f9f..c0b0eda 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,25 @@ Parallel list processing ------ If a list name ends with `=`, the top level of tasks will be treated as parallel `@next_action`s. The waterfall processing will be applied the same way as sequential lists - every parent task will be treated as sequential. This can be overridden by appending `=` to the name of the parent task. + +Executing NextAction +==================== + +You can run NexAction from any system that supports Python, and also deploy to Heroku as a constant running service + +Running NextAction +------------------ + +NextAction will read your environment to retrieve your Todoist API key, so to run on a Linux/Mac OSX you can use the following commandline + + TODOIST_API_KEY="XYZ" python nextaction.py + +Heroku Support +-------------- + +[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) + +This package is ready to be pushed to a Heroku instance with minimal configuration values: + +* ```TODOIST_API_KEY``` - Your Todoist API Key +* ```TODOIST_NEXT_ACTION_LABEL``` - The label to use in Todoist for next actions (defaults to next_action) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100644 index 0000000..5ddd379 --- /dev/null +++ b/app.json @@ -0,0 +1,16 @@ +{ + "name": "NextAction", + "description": "Todoist API application to provide a auto-populated next action label", + "repository": "https://github.com/nikdoof/NextAction", + "keywords": ["python"], + "env": { + "TODOIST_API_KEY": { + "description": "Your Todoist API Key", + "required": true + }, + "TODOIST_NEXT_ACTION_LABEL": { + "description": "The Todoist label to use for next actions.", + "value": "next_action", + "required": false + } +} \ No newline at end of file diff --git a/nextaction.py b/nextaction.py index ff170b5..085c419 100755 --- a/nextaction.py +++ b/nextaction.py @@ -9,9 +9,10 @@ import logging import time import urllib import urllib2 +import os -API_TOKEN = 'API TOKEN HERE' -NEXT_ACTION_LABEL = u'next_action' +API_TOKEN = os.environ.get('TODOIST_API_KEY', None) +NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action') TODOIST_VERSION = '5.3' class TraversalState(object): diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4ea05ed --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +python-dateutil \ No newline at end of file