def handle_rest_errors(self, exception, http_status_code, response, url, method='GET'):
    error = None
    string_code = str(http_status_code)
    if (string_code in self.httpExceptions):
        error = self.httpExceptions[string_code]
        if (error == ExchangeNotAvailable):
            if re.search('(cloudflare|incapsula|overload|ddos)', response, flags=re.IGNORECASE):
                error = DDoSProtection
    if error:
        self.raise_error(error, url, method, (exception if exception else http_status_code), response)
def handle_rest_errors(self, exception, http_status_code, response, url, method='GET'):
    error = None
    string_code = str(http_status_code)
    if (string_code in self.httpExceptions):
        error = self.httpExceptions[string_code]
        if (error == ExchangeNotAvailable):
            if re.search('(cloudflare|incapsula|overload|ddos)', response, flags=re.IGNORECASE):
                error = DDoSProtection
    if error:
        self.raise_error(error, url, method, (exception if exception else http_status_code), response)