I am attempting to salvage some python code to make an e-ink display of tasks from todoist. It was written for a deprecated API but adapting the call only one issue has popped up. After receiving the callback I get
item = str(my_task['content'])
TypeError: 'Task' object is not subscriptable
I'm calling the API here:
def query_todo_list():
global todo_response
global do_screen_update
print('-= Ping ToDo API =-')
while True:
try:
new_todo_response = Todo.get_tasks()
break
except ValueError:
print('-= ToDo API JSON Failed - Will Try Again =-')
time.sleep(todo_wait)
except:
print('-= ToDo API Too Many Pings - Will Try Again =-')
time.sleep(refresh_time)
if ((new_todo_response) != (todo_response)):
print('-= Task List Change Detected =-')
do_screen_update = 1
todo_response = new_todo_response
return True
Later on is the line I am getting the error from:
line_location = 20
for my_task in todo_response:
item = str(my_task['content'])
priority = str(my_task['priority'])
I've replicated the error when trying to print the specific properties of a task, but I can print the output as a whole just fine.