lambda_functions/parseChaseEmail.py
def lambda_handler(event, context):
    '''Get the email describing the transaction, parse it for the transaction
    data, and write that data to DynamoDB.'''
    ses_notification = event['Records'][0]['ses']
    message_id = ses_notification['mail']['messageId']
    try:
        email = s3client.get_object(Bucket=BUCKET_NAME, Key=message_id)
    except botocore.exceptions.ClientError as e:
        if e.response['Error']['Code'] == '404':
            # Could not find email. Exit program.
            print('The object does not exist. Key: ' + message_id)
            sys.exit(1)
        else:
            raise
    contents = email['Body'].read().decode('utf-8')
    (last_digits, date, amount, payee) = parse(contents)
    print('Parsed result:', last_digits, date, amount, payee)
    save_to_db(message_id, last_digits, date, amount, payee)
Get the email describing the transaction, parse it for the transaction
    data, and write that data to DynamoDB.
Get the email describing the transaction, parse it for the transaction
data, and write that data to DynamoDB.
Get the email describing the transaction parse it for the transaction data and write that data to DynamoDB .
def lambda_handler(event, context):
    ses_notification = event['Records'][0]['ses']
    message_id = ses_notification['mail']['messageId']
    try:
        email = s3client.get_object(Bucket=BUCKET_NAME, Key=message_id)
    except botocore.exceptions.ClientError as e:
        if e.response['Error']['Code'] == '404':
            print('The object does not exist. Key: ' + message_id)
            sys.exit(1)
        else:
            raise
    contents = email['Body'].read().decode('utf-8')
    (last_digits, date, amount, payee) = parse(contents)
    print('Parsed result:', last_digits, date, amount, payee)
    save_to_db(message_id, last_digits, date, amount, payee)
def lambda_handler ( event , context ) : ses_notification = event [ 'Records' ] [ 0 ] [ 'ses' ] message_id = ses_notification [ 'mail' ] [ 'messageId' ] try : email = s3client . get_object ( Bucket = BUCKET_NAME , Key = message_id ) except botocore . exceptions . ClientError as e : if e . response [ 'Error' ] [ 'Code' ] == '404' : print ( 'The object does not exist. Key: ' + message_id ) sys . exit ( 1 ) else : raise contents = email [ 'Body' ] . read ( ) . decode ( 'utf-8' ) ( last_digits , date , amount , payee ) = parse ( contents ) print ( 'Parsed result:' , last_digits , date , amount , payee ) save_to_db ( message_id , last_digits , date , amount , payee )
Get the email describing the transaction, parse it for the transaction
data, and write that data to DynamoDB.
Get the email describing the transaction parse it for the transaction data and write that data to DynamoDB .
'''Get the email describing the transaction, parse it for the transaction
    data, and write that data to DynamoDB.''' # Could not find email. Exit program.
event
context