Inkycal/inkycal/modules/inkycal_todoist.py
Ace f0ab9e4558 initial template for todoist api module
Work in progress, please do not use yet.
2020-06-12 18:13:14 +02:00

34 lines
749 B
Python

#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
todoist module for Inky-Calendar Project
Copyright by aceisace
"""
from inkycal.modules.template import inkycal_module
from inkycal.custom import *
try:
import todoist
except ImportError:
print('todoist is not installed! Please install with:')
print('pip3 install todoist-python')
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
api = todoist.TodoistAPI('your api key')
api.sync()
# Print name of author
print(api.state['user']['full_name']+'\n')
tasks = (task.data for task in api.state['items'])
for _ in tasks:
print('task: {} is {}'.format(_['content'], 'done' if _['checked'] == 1 else 'not done'))