From 614fcf2990e7b9660d4cede6bfd887b50938c412 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 9 Aug 2015 15:59:57 -0700 Subject: [PATCH] fix the client api --- client/ponyapi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/ponyapi.py b/client/ponyapi.py index 45cd974..393a74d 100644 --- a/client/ponyapi.py +++ b/client/ponyapi.py @@ -51,7 +51,10 @@ def _base_get(endpoint, *fragments): if r.status_code != 200: raise Exception("Not found or server error") - return r.json() + try: + return r.json()["episodes"] + except: + return r.json()["episode"] return doer @@ -78,4 +81,4 @@ def search(query): if r.status_code != 200: raise Exception("Not found or server error") - return r.json() + return r.json()["episodes"]