Пример #1
0
def get_current_tasks():
    try:
        notion_api = NotionApi()

        current_tasks = []
        for task in notion_api.get_current_tasks():
            current_tasks.append({'id': task.id, 'title': task.title})

        return jsonify(tasks=current_tasks)
    except Exception:
        return 'Failed fetching current tasks', 500
Пример #2
0
#!/usr/local/bin/python3

from notionscripts.notion_api import NotionApi
api = NotionApi()


def app_url(browser_url):
    return browser_url.replace("https://", "notion://")


message = None
for row in api.get_current_tasks():
    message = "%s | href=%s" % (row.title, app_url(row.get_browseable_url()))
    print(message)

if message is None:
    message = "Working on Nothing | href=%s" % app_url(
        api.current_day().get_browseable_url())
    print(message)