"""Lambda json_contract_file_import function module.""" import sentry_sdk from datetime import datetime from lambdacommon.common_config import logger from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration import config from json_contract_file_import import processor if config.SENTRY_DSN: sentry_sdk.init( dsn=config.SENTRY_DSN, environment=config.ENVIRONMENT, integrations=[AwsLambdaIntegration(timeout_warning=True)] ) def handler(event, context): """Lambda entry point.""" try: start_time = datetime.now() processor.process(event) end_time = datetime.now() diff = end_time - start_time logger.info(f'Finished processing in {diff}.') except Exception as e: logger.exception(str(e)) raise e return {'status': 'OK'}