lambda_functions/parseChaseEmail.py
def parse(contents):
    '''Parse the contents of the email for transaction data.'''
    if 'Your Single Transaction Alert from Chase' not in contents:
        print('Email does not match.  Exiting.')
        sys.exit(0)
        
    print('Email matches. Parsing contents.')
        
    remainder = re.split(r'ending{0}in{0}'.format(WS), contents, 1)[1]
    last_digits = remainder[:NUM_DIGITS]
    
    remainder = re.split(r'charge{0}of{0}\(\$USD\){0}'.format(WS),
                         remainder, 1)[1]
    remainder = re.split(r'{0}at{0}'.format(WS), remainder, 1)
    amount = remainder[0].replace(",", "")
    
    remainder = re.split(r'{0}has{0}been{0}authorized{0}on{0}'.format(WS),
                         remainder[1], 1)
    payee = remainder[0]
    
    remainder = re.split(r'{0}at'.format(WS),remainder[1].rstrip(),1)
    date = format_date(remainder[0])
    
    return (last_digits, date, amount, payee)
Parse the contents of the email for transaction data.
Parse the contents of the email for transaction data.
Parse the contents of the email for transaction data .
def parse(contents):
    if 'Your Single Transaction Alert from Chase' not in contents:
        print('Email does not match.  Exiting.')
        sys.exit(0)
    print('Email matches. Parsing contents.')
    remainder = re.split(r'ending{0}in{0}'.format(WS), contents, 1)[1]
    last_digits = remainder[:NUM_DIGITS]
    remainder = re.split(r'charge{0}of{0}\(\$USD\){0}'.format(WS),
                         remainder, 1)[1]
    remainder = re.split(r'{0}at{0}'.format(WS), remainder, 1)
    amount = remainder[0].replace(",", "")
    remainder = re.split(r'{0}has{0}been{0}authorized{0}on{0}'.format(WS),
                         remainder[1], 1)
    payee = remainder[0]
    remainder = re.split(r'{0}at'.format(WS),remainder[1].rstrip(),1)
    date = format_date(remainder[0])
    return (last_digits, date, amount, payee)
def parse ( contents ) : if 'Your Single Transaction Alert from Chase' not in contents : print ( 'Email does not match.  Exiting.' ) sys . exit ( 0 ) print ( 'Email matches. Parsing contents.' ) remainder = re . split ( r'ending{0}in{0}' . format ( WS ) , contents , 1 ) [ 1 ] last_digits = remainder [ : NUM_DIGITS ] remainder = re . split ( r'charge{0}of{0}\(\$USD\){0}' . format ( WS ) , remainder , 1 ) [ 1 ] remainder = re . split ( r'{0}at{0}' . format ( WS ) , remainder , 1 ) amount = remainder [ 0 ] . replace ( "," , "" ) remainder = re . split ( r'{0}has{0}been{0}authorized{0}on{0}' . format ( WS ) , remainder [ 1 ] , 1 ) payee = remainder [ 0 ] remainder = re . split ( r'{0}at' . format ( WS ) , remainder [ 1 ] . rstrip ( ) , 1 ) date = format_date ( remainder [ 0 ] ) return ( last_digits , date , amount , payee )
Parse the contents of the email for transaction data.
Parse the contents of the email for transaction data .
'''Parse the contents of the email for transaction data.'''
contents