From f077053bb26854960dac98637e0b0648ae22ab6b Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 15 Nov 2014 19:49:52 +0000 Subject: [PATCH] Exit if no API key is defined. --- nextaction.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nextaction.py b/nextaction.py index 789c299..d602359 100755 --- a/nextaction.py +++ b/nextaction.py @@ -9,6 +9,7 @@ import time import urllib import urllib2 import os +import sys API_TOKEN = os.environ.get('TODOIST_API_KEY', None) NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action') @@ -376,6 +377,9 @@ def DoSyncAndGetUpdated(items_to_sync, sync_state): def main(): logging.basicConfig(level=logging.INFO) + if not API_TOKEN: + logging.error('No API key set, exiting...') + sys.exit(1) response = GetResponse() json_data = json.loads(response.read()) while True: