I love receiving a text message every morning from Chase Bank containing the balance of my checking account. I dove into my personal account settings to see if I could schedule a message to be sent to me with the other account balances on my account, only to realize that checking was the only account this was possible with.
Using a library called mintapi (https://github.com/mrooney/mintapi), I was able to scrape the account data living in my Mint account. The goal is to send a text message through Twillio with the balance of every single account in my Mint account every single morning.
$ mintapi [email: String] [password: String] --accounts
Running the command above in your terminal returns the following object for each financial account I have in Mint:
{
"linkedAccountId": null,
"addAccountDate": Int,
"fiLoginDisplayName": Str,
"dueDate": "12/27/2017",
"isTerminal": true,
"linkCreationTime": null,
"isActive": true,
"lastUpdated": Int,
"rateType": 2,
"fiName": Str,
"origAmount": null,
"klass": "loan",
"accountTypeInt": 6,
"id": 9856811,
"fiLoginId": 3914975,
"accountType": "loan",
"currentBalance": Int,
"fiLoginStatus": "OK",
"origDate": "02/27/2020",
"linkStatus": "NOT_LINKED",
"accountId": Int,
"yodleeAccountId": Int,
"name": Str (Account Nickname),
"status": "1",
"accountName": Str (Account Name, e.g. Chase Checking),
"ccAggrStatus": 0,
"exclusionType": "0",
"linkedAccount": null,
"isHiddenFromPlanningTrends": true,
"accountStatus": "1",
"accountSystemStatus": "ACTIVE",
"fiLastUpdated": Int,
"yodleeAccountNumberLast4": "Int",
"isError": false,
"isAccountNotFound": false,
"rate": null,
"possibleLinkAccounts": [],
"lastUpdatedInString": "12 hours",
"currency": "USD",
"term": 100,
"isHostAccount": false,
"value": Int (Confidential - Account Balance),
"usageType": null,
"interestRate": null,
"isAccountClosedByMint": false,
"userName": null,
"yodleeName": Str,
"closeDate": Int,
"dueAmt": Int (Confidential - Amount due on next bill),
"amountDue": 0.0,
"isClosed": false,
"fiLoginUIStatus": "OK",
"addAccountDateInDate": "2017-06-11 13:54:06",
"closeDateInDate": "2018-03-30 08:21:39",
"fiLastUpdatedInDate": "2018-03-31 05:33:47",
"lastUpdatedInDate": "2018-03-31 05:33:47"
}
What I would like to do is capture the output from the bash script above, and store it as JSON data in a python variable.
Edit: Since asking the question, I have discovered the subprocess library.
import subprocess
out = subprocess.run("mintapi 'email' '******' --accounts", shell=True)
Now, my return value is:
CompletedProcess(args="mintapi 'email' '*******' --accounts", returncode=0)
2
Answers
Oh! It took me a while before I finally understood the question, whoops.
Twilio have API documentation for sending a message and even a Python library with example code. The two links should be enough to help you with this, good luck.
EDIT
Try using
subprocess.getoutput()
(https://docs.python.org/3/library/subprocess.html#subprocess.getoutput)You could then (probably) combine this with ast.literal_eval() as such
Then
output
would end up being the data you need 🙂Solution by OP.