mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Fixed requests HTTPError handler, it was still in urllib2 style
This commit is contained in:
parent
1a4cd6002f
commit
a3216f813d
@ -122,10 +122,10 @@ def query(key, keyid, method='GET', params=None, headers=None,
|
||||
verify=verify_ssl)
|
||||
response = result.content
|
||||
except requests.exceptions.HTTPError as exc:
|
||||
log.error('There was an error::')
|
||||
if hasattr(exc, 'code') and hasattr(exc, 'msg'):
|
||||
log.error(' Code: {0}: {1}'.format(exc.code, exc.msg))
|
||||
log.error(' Content: \n{0}'.format(exc.read()))
|
||||
log.error('Failed to {0} {1}::'.format(method, requesturl))
|
||||
log.error(' Exception: {0}'.format(exc))
|
||||
if exc.response:
|
||||
log.error(' Response content: {0}'.format(exc.response.content))
|
||||
return False
|
||||
|
||||
log.debug('S3 Response Status Code: {0}'.format(result.status_code))
|
||||
|
Loading…
Reference in New Issue
Block a user