def parse_success_response(self, response):
        """Logging and checking response body for errors."""
        try:
            response_text = json.loads(response.text)
        except json.JSONDecodeError:
            logging.error(self.mimecast_endpoint + ": Invalid content provided. Probably no more logs left.")
            raise InvalidDataError("Invalid content provided. Probably no more logs.")
        if response_text["fail"]:
            logging.error(self.mimecast_endpoint + ": " + response_text["fail"][0]["errors"][0]["message"])
        else:
            return response_text["data"]
Logging and checking response body for errors.
Solutions/MimecastTTP/Data Connectors/Helpers/response_helper.py