mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-11 16:36:14 +01:00
- use HTTPError.hdrs instead of HTTPError.headers
There are situations where a HTTPError instance has no headers attribute.
This commit is contained in:
parent
444a503bca
commit
a754164067
@ -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())
|
||||
|
@ -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:")
|
||||
|
Loading…
Reference in New Issue
Block a user