def _startJob(self): response = None client = AwsHelper().getClient('textract', self.inputParameters.awsRegion) if (not self.inputParameters.detectForms and not self.inputParameters.detectTables): response = client.start_document_text_detection( DocumentLocation={ 'S3Object': { 'Bucket': self.inputParameters.bucketName, 'Name': self.inputParameters.documentPath } }) else: features = [] if (self.inputParameters.detectTables): features.append("TABLES") if (self.inputParameters.detectForms): features.append("FORMS") response = client.start_document_analysis(DocumentLocation={ 'S3Object': { 'Bucket': self.inputParameters.bucketName, 'Name': self.inputParameters.documentPath } }, FeatureTypes=features) return response["JobId"]
def startJob(bucketName, objectName, documentId, snsTopic, snsRole, detectForms, detectTables): print("Starting job with documentId: {}, bucketName: {}, objectName: {}". format(documentId, bucketName, objectName)) response = None client = AwsHelper().getClient('textract') if (not detectForms and not detectTables): response = client.start_document_text_detection( ClientRequestToken=documentId, DocumentLocation={ 'S3Object': { 'Bucket': bucketName, 'Name': objectName } }, NotificationChannel={ "RoleArn": snsRole, "SNSTopicArn": snsTopic }, JobTag=documentId) else: features = [] if (detectTables): features.append("TABLES") if (detectForms): features.append("FORMS") response = client.start_document_analysis( ClientRequestToken=documentId, DocumentLocation={ 'S3Object': { 'Bucket': bucketName, 'Name': objectName } }, FeatureTypes=features, NotificationChannel={ "RoleArn": snsRole, "SNSTopicArn": snsTopic }, JobTag=documentId) return response["JobId"]
def startJob(bucketName, objectName, documentId, snsTopic, snsRole): print("Starting job with documentId: {}, bucketName: {}, objectName: {}". format(documentId, bucketName, objectName)) response = None client = AwsHelper().getClient('textract') response = client.start_document_analysis(ClientRequestToken=documentId, DocumentLocation={ 'S3Object': { 'Bucket': bucketName, 'Name': objectName } }, FeatureTypes=["FORMS", "TABLES"], NotificationChannel={ "RoleArn": snsRole, "SNSTopicArn": snsTopic }, JobTag=documentId) return response["JobId"]