aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-01-29 15:17:59 +0000
committerMichael Wood <michael.g.wood@intel.com>2015-01-29 15:17:59 +0000
commitbc2a77e017550c25def80f448c067c657bb18bf1 (patch)
tree2f626555d2b029c0c07ce58b1fd0ce5072a8c1bd
parent9c62f074da97f8bef9c0d92451fc8cafa9769366 (diff)
downloaderror-report-web-bc2a77e017550c25def80f448c067c657bb18bf1.tar.gz
error-report-web-bc2a77e017550c25def80f448c067c657bb18bf1.tar.bz2
error-report-web-bc2a77e017550c25def80f448c067c657bb18bf1.zip
test-send: Handle HTTP error gracefully
Read the server's response on http error and exit successfully Signed-off-by: Michael Wood <michael.g.wood@intel.com>
-rwxr-xr-xtest-data/test-send-error.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/test-data/test-send-error.py b/test-data/test-send-error.py
index 01a6465..7070c18 100755
--- a/test-data/test-send-error.py
+++ b/test-data/test-send-error.py
@@ -16,7 +16,11 @@ def send_data (url, data_file):
data = urllib.urlencode({'data': data })
req = urllib2.Request(url, data=data, headers={'Content-type': 'application/json'})
- response = urllib2.urlopen(req)
+ try:
+ response = urllib2.urlopen(req)
+ except urllib2.HTTPError, e:
+ response = e
+
print "===== Response ===="
print response.read()
@@ -27,3 +31,5 @@ if __name__ == '__main__':
else:
send_data(sys.argv[1], sys.argv[2])
+
+ sys.exit(0)