def _get_site_status_code(self, url, status_code, api, num_tries, num_apikey_tries):
        """
        Check the http status code and num_tries/num_apikey_tries to see if it should try again or not
        Log any data as needed
        """
        # Make status code an int
        try:
            status_code = int(status_code)
        except ValueError:
            logger.exception("Incorrect status code passed in")
            return None
        # TODO: Try with the same api key 3 times, then try with with a new apikey the same way for 3 times as well
        # try_profile_again = False
        # if api is True and num_apikey_tries < self._num_retries:
        #     # Try with the same apikey/profile again after a short wait
        #     try_profile_again = True

        # Retry for any status code in the 400's or greater
        if status_code >= 400 and num_tries < self._num_retries:
            # Fail after 3 tries
            logger.info("HTTP error, try #{}, Status: {} on url: {}".format(num_tries, status_code, url),
                        extra={'status_code': status_code,
                               'num_tries': num_tries,
                               'url': url})
            time.sleep(.5)
            self.new_profile()
            return True

        else:
            logger.warning("HTTPError [get_site]\n\t# of Tries: {}\n\tCode: {} - {}"
                           .format(num_tries, status_code, url),
                           extra={'status_code': status_code,
                                  'num_tries': num_tries,
                                  'url': url})

        return None
def _get_site_status_code ( self , url , status_code , api , num_tries , num_apikey_tries ) : try : status_code = int ( status_code ) except ValueError : logger . exception ( "Incorrect status code passed in" ) return None if status_code >= 400 and num_tries < self . _num_retries : logger . info ( "HTTP error, try #{}, Status: {} on url: {}" . format ( num_tries , status_code , url ) , extra = { 'status_code' : status_code , 'num_tries' : num_tries , 'url' : url } ) time . sleep ( .5 ) self . new_profile ( ) return True else : logger . warning ( "HTTPError [get_site]\n\t# of Tries: {}\n\tCode: {} - {}" . format ( num_tries , status_code , url ) , extra = { 'status_code' : status_code , 'num_tries' : num_tries , 'url' : url } ) return None
Check the http status code and num_tries/num_apikey_tries to see if it should try again or not
        Log any data as needed