mega-commit

This commit is contained in:
2017-05-24 12:14:58 -04:00
parent 4617d2d9ba
commit fe4fcc4919
10 changed files with 376 additions and 76 deletions

14
send_summary.py Normal file
View File

@@ -0,0 +1,14 @@
import os
from typing import List
from twilio.rest import Client as TwilioClient
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)