From 8f50b4adae9506cbc98e2c3abcc303c6c34459f0 Mon Sep 17 00:00:00 2001 From: zevav Date: Wed, 24 May 2017 15:36:25 -0400 Subject: [PATCH] typo, plus actually calling send_summary in the send_summary module --- spending_summary.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spending_summary.md b/spending_summary.md index 178a50b..9075bc0 100644 --- a/spending_summary.md +++ b/spending_summary.md @@ -200,24 +200,30 @@ As of 5/24/2017, the most recent transactions available in these sandbox account Let's send an SMS to ourselves with the total spent yesterday! -get_send_summary.py +send_summary.py ```python ... from twilio.rest import Client as TwilioClient +from get_yesterdays import get_yesterdays + twilio_client = TwilioClient(os.getenv('TWILIO_SID'), os.getenv('TWILIO_TOKEN')) def send_summary(transactions: List[dict]) -> None: total_spent = sum(transaction['amount'] for transaction in transactions) - message = f'You spent ${total_spent} yesterday. 💸' - twilio_client.api.account.messages.create(to=os.getenv('MY_CELL'), from_=os.getenv('MY_TWILIO_NUM'), body=message) +if __name__ == "__main__": + send_summary(get_yesterdays()) + +```bash +$ python get_send_summary.py ``` + Voila! ![mobile screenshot](screenshot.png)