我正在使用 zeep 连接到 Five9 呼叫中心 API 以检索呼叫日志报告。
我的代码如下:
class Five9api:
start = (datetime.now() - timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
end = datetime.now()
user = 'user'
pwd = 'pwd'
criteria = {'time': {'end': end, 'start': start}}
key = None
def __init__(self, folderName, reportName):
self.client = None
self.folderName = folderName
self.reportName = reportName
def open_client(self):
if self.client is None:
self.client = Five9(self.user, self.pwd)
def run_report(self):
identifier = self.client.configuration.runReport(folderName=self.folderName, reportName=self.reportName,
criteria=self.criteria)
Five9api.key = identifier
def get_report_results(self):
get_results = self.client.configuration.getReportResult(Five9api.key)
return get_results
当我使用该方法run_report
返回一个传递给该方法的键时,我收到一个错误get_report_results
。是什么导致了以下错误?
zeep.exceptions.Fault: Result is not ready due to process is not complete
time.sleep
解决此错误的唯一方法是在上述两种方法之间引入一个像这样的...
Report = Five9api("Call Log Reports", "Call Log")
Report.open_client()
Report.run_report()
time.sleep(5)
data = Report.get_report_results()