コード例 #1
0
            try:
                #Merge DataSource with documnet and convert it to PDF
                job = mergeApi.MergeDatasource(
                    clientId,
                    guid,
                    addDataSource.result.datasource_id,
                    targetType="pdf")

                if job.status == "Ok":
                    #Time delay necessary for server side processing
                    time.sleep(5)
                    i = 0
                    for counter in range(5):
                        # Make request to api for get document info by job id
                        try:
                            jobInfo = asyncApi.GetJobDocuments(
                                clientId, job.result.job_id)

                            if jobInfo.result.job_status == "Completed" or jobInfo.result.job_status == "Archived":
                                break

                        except Exception, e:
                            return render_to_response(
                                '__main__:templates/sample31.pt',
                                {'error': str(e)})
                        i = i + 1
                    #If job status Postponed throw exception with error
                    if jobInfo.result.job_status == "Postponed":
                        return render_to_response(
                            '__main__:templates/sample31.pt',
                            {'error': 'Merge datasource is failed'})
                    fileGuid = jobInfo.result.inputs[0].outputs[0].guid