我开发了一个小的命令行应用程序来带google任务,但是返回指定任务列表中的所有任务不会返回已完成的任务,希望showCompleted默认为
所以我在Live API中尝试了很多次,只返回了未完成的任务,请自行查看:https://developers.google.com/tasks/v1/reference/tasks/list
对于那些不了解的人,请转到您的Gmail,添加一个未完成的任务和一个已完成的任务,然后转到实时API并对其进行测试,即使将showCompleted设置为,您仍会看到未出现已完成的任务真正! 他们如何在Google Tasks的在线版本中完成任务?
tasks = service.tasks().list(tasklist='@default').execute()
for task in tasks['items']:
print task['title']
print task['status']
print task['completed']
答案 0 :(得分:1)
如果我的理解是正确的,那么该修改如何?
为了检索完成的任务,请按如下方式使用showHidden
的属性。 showCompleted
的属性默认为True
。2
tasks = service.tasks().list(tasklist='@default').execute()
for task in tasks['items']:
print task['title']
print task['status']
print task['completed']
至:
tasks = service.tasks().list(tasklist='@default', showHidden=True).execute() # Modified
for task in tasks['items']:
print(task['title'])
print(task['status'])
if 'completed' in task: # Added
print(task['completed'])
else:
print('not completed')
如果我误解了您的问题,而这不是您想要的结果,我深表歉意。