def load_artifact()

in bot/code_review_bot/tasks/base.py [0:0]


    def load_artifact(self, queue_service, artifact_name):
        url = queue_service.buildUrl("getArtifact", self.id, self.run_id, artifact_name)
        # Allows HTTP_30x redirections retrieving the artifact
        response = queue_service.session.get(url, stream=True, allow_redirects=True)

        try:
            response.raise_for_status()
        except Exception as e:
            logger.warn(
                "Failed to read artifact",
                task_id=self.id,
                run_id=self.run_id,
                artifact=artifact_name,
                error=e,
            )
            return None, True

        # Load artifact's data, either as JSON or YAML
        if artifact_name.endswith(".json"):
            content = response.json()
        elif artifact_name.endswith(".yml") or artifact_name.endswith(".yaml"):
            content = yaml.load_stream(response.text)
        else:
            # Json responses are automatically parsed into Python structures
            content = response.content or None
        return content, False