diff options
author | 2018-02-11 18:06:49 +0000 | |
---|---|---|
committer | 2018-02-11 18:06:49 +0000 | |
commit | 893ba325d71d264cf712e9d3d08c1524ac77dc01 (patch) | |
tree | 020f2bf9fc9d26d5cc32c2048aea38cdfed741d0 /pysite | |
parent | First attempt at story hook (diff) |
[Asana] Apparently not all stories have types?
Diffstat (limited to 'pysite')
-rw-r--r-- | pysite/views/api/asana.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pysite/views/api/asana.py b/pysite/views/api/asana.py index d83abe6c..944e5d8e 100644 --- a/pysite/views/api/asana.py +++ b/pysite/views/api/asana.py @@ -87,7 +87,7 @@ class IndexView(APIView): session = requests.session() story = session.get(f"{STORY_URL}/{resource}").json() - if story["type"] == "comment" and action == "added": # New comment! + if story.get("type", None) == "comment" and action == "added": # New comment! task = session.get(f"{TASK_URL}/{parent}").json() user = session.get(f"{USER_URL}/{user}").json() project = task["projects"][0] # Just use the first project in the list @@ -116,6 +116,7 @@ class IndexView(APIView): title=f"Unknown story action/type: {action}/{story['type']}", description=f"```json\n{pretty_story}\n```" ) + session.close() def asana_unknown(self, *, resource, parent, created_at, user, action, type): pretty_event = json.dumps( |