예제 #1
0
def add_task():
    try:
        notion_api = NotionApi()

        collection = notion_api.tasks_database().collection

        row = collection.add_row()
        row.name = request.json['title']

        return 'Succeceed in adding task', 200
    except Exception:
        return 'Failed in adding task', 500
예제 #2
0
def add_task():
    try:
        notion_api = NotionApi()

        collection = notion_api.tasks_database().collection

        row = collection.add_row()
        row.name = request.json['title']
        row.status = 'Next Up'
        row.tags = [notion_api.config.imported_tag_url()]

        return 'Succeceed in adding task', 200
    except Exception:
        return 'Failed in adding task', 500
예제 #3
0
def add_task():
    try:
        notion_api = NotionApi()

        collection = notion_api.tasks_database().collection

        # HACK: For some reason, we need all the views loaded up for the collection.add_row() to work
        #       it also has to be 'printed' for whatever reason, just accessing it doesn't work
        # https://github.com/jamalex/notion-py/issues/92
        print(collection.parent.views)

        row = collection.add_row()
        row.name = request.json['title']
        row.status = 'Next Up'
        row.tags = [notion_api.config.imported_tag_url()]

        return 'Succeceed in adding task', 200
    except Exception:
        return 'Failed in adding task', 500