From 81386dfaa72b4c8793c7ce663fcd50e9ead2fe9d Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 17 Aug 2016 15:26:35 +0200 Subject: Check the response status code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now an HTTPError exception is raised in case of a 4XX or 5XX error response. Change-Id: Idd91c1d2b2a1b81a1cf7d075527cb302099cdb4e Signed-off-by: Cédric Ollivier --- utils/functest_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/functest_utils.py b/utils/functest_utils.py index 3dd93fd2..862b5339 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -219,6 +219,7 @@ def push_results_to_db(project, case_name, logger, r = requests.post(url, data=json.dumps(params), headers=headers) if logger: logger.debug(r) + r.raise_for_status() return True except Exception, e: print("Error [push_results_to_db('%s', '%s', '%s', " + -- cgit 1.2.3-korg