From f75d2d6dc21867e3ed33c3973052abf9deab16c6 Mon Sep 17 00:00:00 2001 From: Alvaro Lopez Garcia Date: Fri, 10 Apr 2015 10:05:03 +0200 Subject: [PATCH] Check for other valid return codes 200, 201 and 202 are valid return codes that will contain a JSON, so we should check for them also. --- ooi/api/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ooi/api/base.py b/ooi/api/base.py index 503d30e..77858ed 100644 --- a/ooi/api/base.py +++ b/ooi/api/base.py @@ -63,7 +63,7 @@ def get_from_response(response, element, default): :param element: The element to look for in the JSON body :param default: The default element to be returned if not found. """ - if response.status_int == 200: + if response.status_int in [200, 201, 202]: return response.json_body.get(element, default) else: raise exception_from_response(response)