in code/textract_sync/textract_processor.py [0:0]
def processRequest(bucketName, objectName, callerId):
output = ""
documentId = S3Helper().getTagsS3(bucketName, objectName).get('documentId', None)
if not documentId:
raise Exception("Unidentified document. Please check its tags.")
pipeline_client.body = {
"documentId": documentId,
"bucketName": bucketName,
"objectName": objectName,
"stage": PIPELINE_STAGE
}
pipeline_client.stageInProgress()
print('Task ID: ' + documentId)
if(documentId and bucketName and objectName):
print("DocumentId: {}, Object: {}/{}".format(documentId, bucketName, objectName))
processImage(documentId, bucketName, objectName, callerId)
output = "Document: {}, Object: {}/{} processed.".format(documentId, bucketName, objectName)
pipeline_client.stageSucceeded()
print(output)
else:
pipeline_client.stageFailed()
return {
'statusCode': 200,
'body': output
}