diff options
author | Ben Copeland <ben.copeland@linaro.org> | 2017-12-30 11:31:18 +0000 |
---|---|---|
committer | Ben Copeland <ben.copeland@linaro.org> | 2017-12-30 11:31:18 +0000 |
commit | ed839cad55fd24adff159d4f228d123b7907e60f (patch) | |
tree | c4f19b0d9a71ae64896704578c3ab82ca6ad2d57 | |
parent | 20619788f9a38f3b7a47e0ff2c6124b79a739d75 (diff) |
Print states: Fix print statements to give us better output
Change-Id: Id9cee962f1ac9dca38dc31640f1a79f3e614ffec
-rwxr-xr-x | linaro-cp.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/linaro-cp.py b/linaro-cp.py index 0b18179..43df16e 100755 --- a/linaro-cp.py +++ b/linaro-cp.py @@ -27,12 +27,13 @@ class API_v1(object): for x in range(retry_count): try: resp = requests.post(url, headers=headers, data=data, files=files, timeout=61) + print(resp.content, resp.headers) if resp.status_code in (200, 201): - return resp + return else: print("Unsuccessful status:", resp.status_code) except Exception as e: - print('Error: %s,\nBody: %s,\nHeaders: %s' % (e, resp.content, resp.headers)) + print(e) print('Upload failed for %s, retry attempt %s' % (url, x)) time.sleep(2 * x + 1) retry_count -= 1 @@ -143,12 +144,13 @@ class API_v3(API_v1): with open(filename, 'rb') as f: print("Uploading file %s" % filename) resp = requests.put(url, headers=headers, data=f, timeout=61) + print(resp.content, resp.headers) if resp.status_code in (200, 201): return else: print("Unsuccessful status:", resp.status_code) except Exception as e: - print('Error: %s,\nBody: %s,\nHeaders: %s' % (e, resp.content, resp.headers)) + print(e) print('Upload failed for %s, retry attempt %s' % (url, x)) time.sleep(2 * x + 1) retry_count -= 1 |