Ejemplo n.º 1
0
def tasks_list(session):
    """list tasks from all available folders"""
    headers = ["id", "folder", "title", "last_modified"]
    TasksList = namedtuple("TasksList", headers)
    # get all folders
    _, tasks_folder_list = folder_list(session, "tasks")

    tasks = []
    for tasks_folder in tasks_folder_list:
        args = {
            "action": "all",
            "folder": tasks_folder.id,
            "columns": "1,200,5"  # id, folder
        }
        r = session.request("get", "/tasks", {"params": args})
        for task in r.json()["data"]:
            # add the folder name to the right position
            task.insert(1, tasks_folder.title)
            tasks.append(TasksList._make(task))
    return (headers, tasks)
Ejemplo n.º 2
0
 def take_action(self, parsed_args):
     return folder_list(self.app._session, "tasks")