Using Python API to get all comments on a project

I am trying to use the Asana API with python to pull all the comments for all my projects. I understand from asana support that to do this I need to get_story. How do I get a story gid? I don’t see anything in Asana that says story to pull from. I do have the project id.

I’m currently using the below but am open to suggestions:
client.stories.get_story(‘GID’, opt_pretty=True)

Hi @Hope_Stiles and welcome to the forum!

Point of clarification: are you referring to project conversations, or comments on individual tasks?

comments on individual tasks. I exported the projects to CSV and have all the tasks, and associated fields, but I want to get the comments that go along with them.

Gotcha.

The get_story method requires a story gid, as you noted, and only gets you one specific story.

What you want to use instead is get_stories_for_task. You’ll loop through each task that you have in your CSV list, and for each one, call that method to retrieve all of that task’s stories.

1 Like