def collect(self):
        url = self.config['url']

        req = urllib2.Request(url)
        req.add_header('Content-type', 'application/json')

        try:
            resp = urllib2.urlopen(req)
        except urllib2.URLError as e:
            self.log.error("Can't open url %s. %s", url, e)
        else:

            content = resp.read()

            try:
                data = json.loads(content)
            except __HOLE__ as e:
                self.log.error("Can't parse JSON object from %s. %s", url, e)
            else:
                for metric_name, metric_value in self._json_to_flat_metrics(
                        "", data):
                    self.publish(metric_name, metric_value)
dataset/ETHPy150Open BrightcoveOS/Diamond/src/collectors/httpjson/httpjson.py/HTTPJSONCollector.collect