Fix attribute error accessing response.text
The response object *should* be a requests.Response object, which *should* have a .text property. However, there are situations where this is not the case, and in those cases we now won't produce an AttributeError.
This commit is contained in:
@@ -94,8 +94,9 @@ class FlaskInternalApi(pillarsdk.Api):
|
||||
return response
|
||||
|
||||
exception = exceptions.exception_for_status(response.status_code)
|
||||
text = getattr(response, 'text', '')
|
||||
if exception:
|
||||
raise exception(response, response.text)
|
||||
raise exception(response, text)
|
||||
|
||||
raise exceptions.ConnectionError(response, response.text,
|
||||
raise exceptions.ConnectionError(response, text,
|
||||
"Unknown response code: %s" % response.status_code)
|
||||
|
Reference in New Issue
Block a user