def report_now(self, registry=None, timestamp=None):
        metrics = self._collect_metrics(registry or self.registry, timestamp)
        if metrics:
            try:
                # XXX: better use http-keepalive/pipelining somehow?
                request = urllib2.Request(self.url, metrics)
                request.add_header("Authorization", "Basic %s" %
                                   base64.encodestring(self.api_key).strip())
                result = urllib2.urlopen(request)
            except Exception as e:
                print(e, file=sys.stderr)
dataset/ETHPy150Open omergertel/pyformance/pyformance/reporters/hosted_graphite_reporter.py/HostedGraphiteReporter.report_now/original