lambda_functions/parseUSBankEmail.py
def parse(contents):
    '''Parse the contents of the email for transaction data.'''
    if 'Your U.S. Bank credit card has a new transaction' not in contents:
        sys.exit(0)
    remainder = re.split(r'was{0}charged{0}'.format(WS),
                                    contents, 1)[1]
    remainder = re.split(r'{0}at{0}'.format(WS), remainder, 1)
    amount = remainder[0][1:] #[1:] removes $
    remainder = re.split(r'.\r\n'.format(WS), remainder[1], 1)
    payee=remainder[0]
    remainder = re.split(r'ending{0}in{0}'.format(WS), remainder[1], 1)[1]
    last_digits = remainder[:NUM_DIGITS]
    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 U.S. Bank credit card has a new transaction' not in contents:
        sys.exit(0)
    remainder = re.split(r'was{0}charged{0}'.format(WS),
                                    contents, 1)[1]
    remainder = re.split(r'{0}at{0}'.format(WS), remainder, 1)
    amount = remainder[0][1:] 
    remainder = re.split(r'.\r\n'.format(WS), remainder[1], 1)
    payee=remainder[0]
    remainder = re.split(r'ending{0}in{0}'.format(WS), remainder[1], 1)[1]
    last_digits = remainder[:NUM_DIGITS]
    return (last_digits, date, amount, payee)
def parse ( contents ) : if 'Your U.S. Bank credit card has a new transaction' not in contents : sys . exit ( 0 ) remainder = re . split ( r'was{0}charged{0}' . format ( WS ) , contents , 1 ) [ 1 ] remainder = re . split ( r'{0}at{0}' . format ( WS ) , remainder , 1 ) amount = remainder [ 0 ] [ 1 : ] remainder = re . split ( r'.\r\n' . format ( WS ) , remainder [ 1 ] , 1 ) payee = remainder [ 0 ] remainder = re . split ( r'ending{0}in{0}' . format ( WS ) , remainder [ 1 ] , 1 ) [ 1 ] last_digits = remainder [ : NUM_DIGITS ] 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.''' #[1:] removes $
contents