handler.py [358:392]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    dynamodb = boto3.resource("dynamodb")
    ddb_table = os.environ['DYNAMODB_TABLE']
    aha_ddb_table = dynamodb.Table(ddb_table)
    event_latestDescription = event_details['successfulSet'][0]['eventDescription']['latestDescription']
    # set time parameters
    delta_hours = os.environ['EVENT_SEARCH_BACK']
    delta_hours = int(delta_hours)
    delta_hours_sec = delta_hours * 3600

    # formatting time in seconds
    srt_ddb_format_full = "%Y-%m-%d %H:%M:%S"
    str_ddb_format_sec = '%s'
    sec_now = datetime.strftime(datetime.now(), str_ddb_format_sec)

    # check if event arn already exists
    try:
        response = aha_ddb_table.get_item(
            Key={
                'arn': event_arn
            }
        )
    except ClientError as e:
        print(e.response['Error']['Message'])
    else:
        is_item_response = response.get('Item')
        if is_item_response == None:
            print(datetime.now().strftime(srt_ddb_format_full) + ": record not found")
            # write to dynamodb
            response = aha_ddb_table.put_item(
                Item={
                    'arn': event_arn,
                    'lastUpdatedTime': str_update,
                    'added': sec_now,
                    'ttl': int(sec_now) + delta_hours_sec + 86400,
                    'statusCode': status_code,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



handler.py [439:474]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    dynamodb = boto3.resource("dynamodb")
    ddb_table = os.environ['DYNAMODB_TABLE']
    aha_ddb_table = dynamodb.Table(ddb_table)
    event_latestDescription = event_details['successfulSet'][0]['eventDescription']['latestDescription']

    # set time parameters
    delta_hours = os.environ['EVENT_SEARCH_BACK']
    delta_hours = int(delta_hours)
    delta_hours_sec = delta_hours * 3600

    # formatting time in seconds
    srt_ddb_format_full = "%Y-%m-%d %H:%M:%S"
    str_ddb_format_sec = '%s'
    sec_now = datetime.strftime(datetime.now(), str_ddb_format_sec)

    # check if event arn already exists
    try:
        response = aha_ddb_table.get_item(
            Key={
                'arn': event_arn
            }
        )
    except ClientError as e:
        print(e.response['Error']['Message'])
    else:
        is_item_response = response.get('Item')
        if is_item_response == None:
            print(datetime.now().strftime(srt_ddb_format_full) + ": record not found")
            # write to dynamodb
            response = aha_ddb_table.put_item(
                Item={
                    'arn': event_arn,
                    'lastUpdatedTime': str_update,
                    'added': sec_now,
                    'ttl': int(sec_now) + delta_hours_sec + 86400,
                    'statusCode': status_code,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



