initial template for todoist api module
Work in progress, please do not use yet.
This commit is contained in:
parent
85dc6871a0
commit
f0ab9e4558
33
inkycal/modules/inkycal_todoist.py
Normal file
33
inkycal/modules/inkycal_todoist.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/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'))
|
Loading…
Reference in New Issue
Block a user