in translate_json/s3_event_handler.py [0:0]
def startTranslationJob(bucketName, sourceCode, destCode,access_role):
translate = AwsHelper().getClient('translate')
try:
millis = int(round(time.time() * 1000))
response = translate.start_text_translation_job(
JobName="TranslateJob-json-{}".format(millis),
InputDataConfig={
'S3Uri': "s3://{}/xmlin/".format(bucketName),
'ContentType': 'text/html'
},
OutputDataConfig={
'S3Uri': "s3://{}/xmlout/".format(bucketName)
},
DataAccessRoleArn=access_role,
SourceLanguageCode=sourceCode,
TargetLanguageCodes=[destCode]
)
print(response["JobId"])
except ClientError as e:
logger.error("An error occured starting the Translate Batch Job: %s" % e)