# Python Events

**URL:** <https://forum.asana.com/t/python-events/43196>\
**Category:** API & Developers\
**Created:** [26 February 2019 18:29 UTC](https://forum.asana.com/t/python-events/43196 "2019-02-26T18:29:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Cardinal](https://luna1.co/8d76cd.png) [@Christopher\_Cardinal](https://forum.asana.com/u/Christopher_Cardinal)\
**Post date:** [26 February 2019 18:29 UTC](https://forum.asana.com/t/python-events/43196/1 "2019-02-26T18:29:43Z")

</div>

Hello. I’m trying to use the Python client library for Asana API to listen for events on projects and react to task ‘added’ events.

Background: A user completes a request via Microsoft Forms. Forms connects to Asana via an Asana connector. All data from the form is copied to the Notes section of the task.

Current: I wrote a Python program to connect to Asana, find new tasks, parse the Notes data, and move that data into appropriate custom fields. This program has been scheduled via Task Scheduler on Windows to run every 15 minutes. It works fine.

Next Step: I’d like to modify the Python program to listen for task ‘added’ events on a number of projects, and update the tasks as needed. When I try to make an initial GET request to Events with Python, an Exception is raised (asana.error.InvalidTokenError) and no sync token is issued. If I make the same request via curl, I see the sync token.

```
try: 
  client.events.get({ 'resource': pycProjectId })
except asana.error.InvalidTokenError as e:
  print(e)

```

> Sync token invalid or too old: Sync token invalid or too old. If you are attempting to keep resources in sync, you must fetch the full dataset for this query now and use the new sync token for the next sync.

Maybe I am going about this the wrong way? Any advice would be appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [26 February 2019 18:40 UTC](https://forum.asana.com/t/python-events/43196/2 "2019-02-26T18:40:11Z")

</div>

I think you’re actually on the right track. The error is to be expected the first time you call the events endpoint. See this post for more info:

> [@Get all events from a project or task](https://forum.asana.com/t/get-all-events-from-a-project-or-task/34271/2):
>
> Hi @carolina, sorry to hear you’re having issues – events can be a bit confusing to work with. I assume you’ve already taken a look at the [event docs](https://asana.com/developers/api-reference/events), but i’ll link to them for other developer’s reference who may read this thread. I think you have the right idea. My guess is that the data object is empty in your response because nothing has changed with the resource since getting that sync token. Here’s how you can test to make sure that you’re using events successfully: Request an initial…

---

<div class="post-metadata">

**Author:** ![Christopher\_Cardinal](https://luna1.co/8d76cd.png) [@Christopher\_Cardinal](https://forum.asana.com/u/Christopher_Cardinal)\
**Post date:** [5 March 2019 20:13 UTC](https://forum.asana.com/t/python-events/43196/3 "2019-03-05T20:13:45Z")

</div>

Thanks for your response, Phil. I’m unable to work with Events.get() (the response is missing a sync token), but Events.get\_next() works as I would expect, so I’m using that and it seems to work well.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 19:08 UTC](https://forum.asana.com/t/python-events/43196/5 "2025-05-30T19:08:04Z")

</div>

Closed on 30 May 2025 19:08 UTC


