From a7541640673b2f719914234252d8a15625a3e156 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Sun, 8 Jun 2014 21:33:06 +0200 Subject: [PATCH] - use HTTPError.hdrs instead of HTTPError.headers There are situations where a HTTPError instance has no headers attribute. --- osc/commandline.py | 2 +- osc/core.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index c7fe3bc9..9102f48e 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -2310,7 +2310,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. print('Result of change request state: %s' % r) except HTTPError as e: print(e, file=sys.stderr) - details = e.headers.get('X-Opensuse-Errorcode') + details = e.hdrs.get('X-Opensuse-Errorcode') if details: print(details, file=sys.stderr) root = ET.fromstring(e.read()) diff --git a/osc/core.py b/osc/core.py index d7f40846..8a021ad1 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3317,8 +3317,8 @@ class metafile: break except HTTPError as e: error_help = "%d" % e.code - if e.headers.get('X-Opensuse-Errorcode'): - error_help = "%s (%d)" % (e.headers.get('X-Opensuse-Errorcode'), e.code) + if e.hdrs.get('X-Opensuse-Errorcode'): + error_help = "%s (%d)" % (e.hdrs.get('X-Opensuse-Errorcode'), e.code) print('BuildService API error:', error_help, file=sys.stderr) # examine the error - we can't raise an exception because we might want @@ -3781,7 +3781,7 @@ def create_submit_request(apiurl, root = ET.parse(f).getroot() r = root.get('id') except HTTPError as e: - if e.headers.get('X-Opensuse-Errorcode') == "submit_request_rejected": + if e.hdrs.get('X-Opensuse-Errorcode') == "submit_request_rejected": print("WARNING:") print("WARNING: Project does not accept submit request, request to open a NEW maintenance incident instead") print("WARNING:")