Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def response(self, response: requests.models.Response):
self._response = response
# parse the text to get the status code and results
if response.text:
lines = response.text.splitlines()
# get the status line, if the request completed OK
if response.status_code == requests.codes.ok:
try:
statusline = response.text.splitlines()[0]
code = statusline.split(' ', 1)[0]
if code in tm.status_codes.values():
self.status_code = code
self.status_message = statusline.split(' ', 1)[1][2:]
if len(lines) > 1:
self.result = "\n".join(lines[1:])
else:
self.status_code = tm.status_codes.notfound
self.status_message = 'Tomcat Manager not found'
except IndexError:
pass