(self, url, send_sc=True)
return resp.json()
Hit a given URL and return the parsed json
Hit a given URL and return the parsed json
Hit a given URL and return the parsed json
def _get_data(self, url, send_sc=True):
        """
        Hit a given URL and return the parsed json
        """
        resp = None
        try:
            resp = self.http.get(url)
            resp.raise_for_status()
        except Exception as e:
            # this means we've hit a particular kind of auth error that means the config is broken
            if resp and resp.status_code == 400:
                raise AuthenticationError("The ElasticSearch credentials are incorrect")

            if send_sc:
                self.service_check(
                    self.SERVICE_CHECK_CONNECT_NAME,
                    AgentCheck.CRITICAL,
                    message="Error {} when hitting {}".format(e, url),
                    tags=self._config.service_check_tags,
                )
            raise

        self.log.debug("request to url %s returned: %s", url, resp)

        return resp.json()
def _get_data ( self , url , send_sc = True ) : resp = None try : resp = self . http . get ( url ) resp . raise_for_status ( ) except Exception as e : # this means we've hit a particular kind of auth error that means the config is broken if resp and resp . status_code == 400 : raise AuthenticationError ( "The ElasticSearch credentials are incorrect" ) if send_sc : self . service_check ( self . SERVICE_CHECK_CONNECT_NAME , AgentCheck . CRITICAL , message = "Error {} when hitting {}" . format ( e , url ) , tags = self . _config . service_check_tags , ) raise self . log . debug ( "request to url %s returned: %s" , url , resp ) return resp . json ( )