def getAttachment(self, reqId, expId, attachmentId): try: rs = ReportingService(self.session) rexecreq = rs.reportExecutionRequest(reqId, expId) content = rexecreq.export().attachment(attachmentId) return content except NotFound: frappe.throw(_("Not Found."))
def getReport(self, reqId, expId): try: rs = ReportingService(self.session) rexecreq = rs.reportExecutionRequest(reqId, expId) report = rexecreq.export().outputResource().getResult("content") return report except NotFound: frappe.throw(_("Not Found."))
def polling(self, reqId): res = [] try: rs = ReportingService(self.session) rexecreq = rs.reportExecutionRequest(reqId) status = rexecreq.status().content status = json.loads(status) if status.get("value") == "ready": detail = self.reportExecDetail(rexecreq) res = self.prepareResponse(detail, reqId) if res.get('status', "") == "not ready": res = self.prepareResponse({}, reqId) else: res["status"] = "ready" elif status.get("value") == "failed": frappe.throw(_("Error in report %s, server error is: %s." % (self.doc.jasper_report_name, status['errorDescriptor'].get('message')))) else: res = self.prepareResponse({}, reqId) except NotFound: frappe.throw(_("Not Found.")) return res