From d328cf3e14179afe673f9bce18b8474b071893cf Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Sun, 11 Feb 2018 18:38:46 +0000 Subject: [Asana] Raise for status properly --- pysite/views/api/asana.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'pysite/views/api/asana.py') diff --git a/pysite/views/api/asana.py b/pysite/views/api/asana.py index 9cac5f38..a76c8052 100644 --- a/pysite/views/api/asana.py +++ b/pysite/views/api/asana.py @@ -88,16 +88,16 @@ class IndexView(APIView): session = requests.session() session.headers["Authorization"] = f"Bearer {ASANA_TOKEN}" - resp = session.get(f"{STORY_URL}/{resource}").json() + resp = session.get(f"{STORY_URL}/{resource}") resp.raise_for_status() story = resp.json() if story.get("type") == "comment" and action == "added": # New comment! - resp = session.get(f"{TASK_URL}/{parent}").json() + resp = session.get(f"{TASK_URL}/{parent}") resp.raise_for_status() task = resp.json() - resp = session.get(f"{USER_URL}/{user}").json() + resp = session.get(f"{USER_URL}/{user}") resp.raise_for_status() user = resp.json() @@ -138,7 +138,9 @@ class IndexView(APIView): task = resp.json() if action == "changed": # New comment! - user = session.get(f"{USER_URL}/{user}").json() + resp = session.get(f"{USER_URL}/{user}") + resp.raise_for_status() + user = resp.json() if user["photo"]: photo = user["photo"]["image_128x128"] -- cgit v1.2.3