def handle_rest_response(self, response, json_response, url, method='GET', headers=None, body=None):
    if (self.is_json_encoded_object(response) and (json_response is None)):
        ddos_protection = re.search('(cloudflare|incapsula|overload|ddos)', response, flags=re.IGNORECASE)
        exchange_not_available = re.search('(offline|busy|retry|wait|unavailable|maintain|maintenance|maintenancing)', response, flags=re.IGNORECASE)
        if ddos_protection:
            self.raise_error(DDoSProtection, method, url, None, response)
        if exchange_not_available:
            message = (response + ' exchange downtime, exchange closed for maintenance or offline, DDoS protection or rate-limiting in effect')
            self.raise_error(ExchangeNotAvailable, method, url, None, message)
        self.raise_error(ExchangeError, method, url, ValueError('failed to decode json'), response)
def handle_rest_response(self, response, json_response, url, method='GET', headers=None, body=None):
    if (self.is_json_encoded_object(response) and (json_response is None)):
        ddos_protection = re.search('(cloudflare|incapsula|overload|ddos)', response, flags=re.IGNORECASE)
        exchange_not_available = re.search('(offline|busy|retry|wait|unavailable|maintain|maintenance|maintenancing)', response, flags=re.IGNORECASE)
        if ddos_protection:
            self.raise_error(DDoSProtection, method, url, None, response)
        if exchange_not_available:
            message = (response + ' exchange downtime, exchange closed for maintenance or offline, DDoS protection or rate-limiting in effect')
            self.raise_error(ExchangeNotAvailable, method, url, None, message)
        self.raise_error(ExchangeError, method, url, ValueError('failed to decode json'), response)