我如何向获取子任务的clickup api发出请求

时间:2019-08-29 15:26:32

标签: python

im正在使用python脚本工作,该脚本每周都会通过Clickup API生成一个包含组织内部员工绩效报告的csv文件。我想编写一个脚本,在csv文件中添加表,以显示子任务,一个月未完成的任务以及3个月前创建的任务。

我尝试使用clickup api中的'due_date'

def final_list(newarr):
    result = []
    flag = False
    print("Processing Team Member")
    for data in newarr:
        for res in result:
            if str(res['name']) == str(data['name']):
                flag = True
                if data['due_date']:
                    res['task_planned_count'] += 1
                    res['task_planned'].append(str(data["task"].encode('ascii','ignore')))            
                    if data['date_created_gt']:    
                        if data['status'] == "in+progress" or data['status'] == "Open" or data['status'] == "planned":
                            res['overdue_task_count'] += 1
                            res['overdue_task'].append(str(data["task"].encode('ascii','ignore')))
                    if data['date_created_gt']:    
                        if data['status'] == "in+progress" or data['status'] == "Open" or data['status'] == "planned":
                            res['ninety_days_overdue_task_count'] += 1
                            res['ninety_days_overdue_task'].append(str(data["task"].encode('ascii','ignore'))) 
                elif data['status'] == "completed" or data['status'] == "done... needs follow up" or data['status'] == "closed":
                    res['task_complete_count'] += 1
                    res['task_done'].append(str(data["task"].encode('ascii','ignore')))
                elif data['status'] == "in progress" or data['status'] == "in review":
                    if data['status'] == "in progress":
                        res['task_in_progress_count'] += 1
                        res['task_in_progress'].append(str(data["task"].encode('ascii','ignore')))
                    else:
                        res['task_in_review'].append(str(data["task"].encode('ascii','ignore')))
                        res["task_in_review_count"] += 1
                elif data['status'] == "Open" or data['status'] == "planned":
                    res['task_incompleted_count'] += 1
                    res['task_not_done'].append(str(data["task"].encode('ascii','ignore')))
                elif data['status'] == "blocked":
                    res['task_blocked'].append(str(data["task"].encode('ascii','ignore')))
                break
            else:
                flag = False
  File "/home/osas/Projects/weekly-task-report/export_csv_all_status_type.py", line 57, in final_list
    dummy["date_created"] = data["date_created"]
KeyError: 'date_created'

0 个答案:

没有答案