コード例 #1
0
def sync():
    """
    Uses official python TodoistAPI to sync the to-do items for the day
    """
    api = TodoistAPI(TodoistAPIkey, cache='/todoist-conky-cache/')
    api.reset_state()
    api.sync()

    #today = '2020-08-11' # must be 'YYYY-MM-DD'
    today = str(date.today())

    todoitem = [today + ':']

    #api.state['items'] contains the entries
    for i in api.state['items']:
        try:
            if today in i['due']['date']:
                todoitem.append(i['content'])
        except TypeError:
            continue

    return ([i + '\n' for i in todoitem])
コード例 #2
0
import requests
import json
from todoist.api import TodoistAPI
from requests.auth import HTTPDigestAuth
from retrieve_canvas_course_ids import load_courses

with open("api_keys.txt") as api_file:
    keys = api_file.readlines()

#Initialize TodoistAPI
todoist_api_token = keys[0].strip()
todoist_api = TodoistAPI(todoist_api_token)
todoist_api.reset_state()
todoist_api.sync()

canvas_api_heading = 'https://canvas.instructure.com'
canvas_token = keys[1].strip()

courses_id_name_dict = load_courses(False)

course_ids = []
for course_id in keys[2:]:
    course_ids.append(int(course_id.strip()))

header = {"Authorization": "Bearer " + canvas_token}
param = {'per_page': '100', 'include': 'submission'}

assignments = []
todoist_tasks = []
todoist_project_dict = {}