From: Cédric Ollivier Date: Wed, 17 Aug 2016 13:26:35 +0000 (+0200) Subject: Check the response status code X-Git-Tag: colorado.1.0~133 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=81386dfaa72b4c8793c7ce663fcd50e9ead2fe9d;p=functest.git Check the response status code Now an HTTPError exception is raised in case of a 4XX or 5XX error response. Change-Id: Idd91c1d2b2a1b81a1cf7d075527cb302099cdb4e Signed-off-by: Cédric Ollivier --- diff --git a/utils/functest_utils.py b/utils/functest_utils.py index 3dd93fd28..862b53390 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', " +