def pushes()

in mozregression/json_pushes.py [0:0]


    def pushes(self, **kwargs):
        """
        Returns a sorted lists of Push objects. The list can not be empty.

        Basically issue a raw request to the server.
        """
        base_url = "%s/json-pushes?" % self.repo_url
        url = base_url + "&".join(sorted("%s=%s" % kv for kv in kwargs.items()))
        LOG.debug("Using url: %s" % url)

        response = retry_get(url)
        data = response.json()

        if (
            response.status_code == 404
            and data is not None
            and "error" in data
            and "unknown revision" in data["error"]
        ):
            raise EmptyPushlogError(
                "The url %r returned a 404 error because the push is not"
                " in this repo (e.g., not merged yet)." % url
            )
        response.raise_for_status()

        if not data:
            raise EmptyPushlogError(
                "The url %r contains no pushlog. Maybe use another range ?" % url
            )

        pushlog = []
        for key in sorted(data):
            pushlog.append(Push(key, data[key]))
        return pushlog