Beispiel #1
0
    def get_query_result(self, url):
        log.debug("url = {0}".format(url))
        res = self.opener.open(url)
        if res.getcode() != 200:
            raise IOError("Cannot retrieve list of changes ({0})".format(res.getcode()))

        # see https://code.google.com/p/gerrit/issues/detail?id=2006
        # for explanation of skipping first four characters
        json_str = res.read()[4:].strip()
        try:
            data = json.loads(json_str)
        except ValueError:
            log.exception("Cannot parse JSON data:\n%s", json_str)
            raise
        res.close()

        return data
Beispiel #2
0
    def get_query_result(self, url):
        log.debug('url = {0}'.format(url))
        res = self.opener.open(url)
        if res.getcode() != 200:
            raise IOError('Cannot retrieve list of changes ({0})'.format(
                res.getcode()))

        # see https://code.google.com/p/gerrit/issues/detail?id=2006
        # for explanation of skipping first four characters
        json_str = res.read()[4:].strip()
        try:
            data = json.loads(json_str)
        except ValueError:
            log.exception('Cannot parse JSON data:\n%s', json_str)
            raise
        res.close()

        return data