Getting task details results in ForbiddenError

I’m using the Python Asana client library to retrieve task details. The API call I’m making is client.tasks.get_task(task_gid). As the code loops through a list of tasks and retrieves the task details it dumps the results into a database. Everything works fine (albeit slow), until it gets to a private(?) task, which then causes the script to fail with the error message “asana.error.ForbiddenError: Forbidden: You do not have access to this task.”

In my error handling, I have tried to handle this as follows:

try:
    do stuff here
except KeyError:
        pass
except asana.error.ForbiddenError:
        print("This task failed to insert: " + str(detail['gid']))
        continue

Unfortunately, this does not resolve the issue and the script continues to fail with the same error. How can I handle the ForbiddenError response?

Hi @Robert_Saari ,

I’m sorry for the very late response.
I tried to fetch a private project (which gives “asana.error.ForbiddenError: Forbidden: You do not have access to this project.”) and the error was handled correctly for me :thinking: