(self, scraper_config)
return http_handler
Get http handler for a specific scraper config.
        The http handler is cached using `prometheus_url` as key.
Get http handler for a specific scraper config.
        The http handler is cached using `prometheus_url` as key.
Get http handler for a specific scraper config . The http handler is cached using prometheus_url as key .
def get_http_handler(self, scraper_config):
        """
        Get http handler for a specific scraper config.
        The http handler is cached using `prometheus_url` as key.
        """
        prometheus_url = scraper_config['prometheus_url']
        if prometheus_url in self._http_handlers:
            return self._http_handlers[prometheus_url]

        # TODO: Deprecate this behavior in Agent 8
        if scraper_config['ssl_ca_cert'] is False:
            scraper_config['ssl_verify'] = False

        # TODO: Deprecate this behavior in Agent 8
        if scraper_config['ssl_verify'] is False:
            scraper_config.setdefault('tls_ignore_warning', True)

        http_handler = self._http_handlers[prometheus_url] = RequestsWrapper(
            scraper_config, self.init_config, self.HTTP_CONFIG_REMAPPER, self.log
        )

        headers = http_handler.options['headers']

        bearer_token = scraper_config['_bearer_token']
        if bearer_token is not None:
            headers['Authorization'] = 'Bearer {}'.format(bearer_token)

        # TODO: Determine if we really need this
        headers.setdefault('accept-encoding', 'gzip')

        # Explicitly set the content type we accept
        headers.setdefault('accept', 'text/plain')

        return http_handler
def get_http_handler ( self , scraper_config ) : prometheus_url = scraper_config [ 'prometheus_url' ] if prometheus_url in self . _http_handlers : return self . _http_handlers [ prometheus_url ] # TODO: Deprecate this behavior in Agent 8 if scraper_config [ 'ssl_ca_cert' ] is False : scraper_config [ 'ssl_verify' ] = False # TODO: Deprecate this behavior in Agent 8 if scraper_config [ 'ssl_verify' ] is False : scraper_config . setdefault ( 'tls_ignore_warning' , True ) http_handler = self . _http_handlers [ prometheus_url ] = RequestsWrapper ( scraper_config , self . init_config , self . HTTP_CONFIG_REMAPPER , self . log ) headers = http_handler . options [ 'headers' ] bearer_token = scraper_config [ '_bearer_token' ] if bearer_token is not None : headers [ 'Authorization' ] = 'Bearer {}' . format ( bearer_token ) # TODO: Determine if we really need this headers . setdefault ( 'accept-encoding' , 'gzip' ) # Explicitly set the content type we accept headers . setdefault ( 'accept' , 'text/plain' ) return http_handler