Hello!
I've been using Microsoft Money to manage my finances for a
number of years. I have been able to automate downloading most of
my bank transactions using some software called PocketSense
but not all banks have an accessible OFX/QFX server. I've written
some simple scrapers in Python that will log into these sites and
download my transactions automatically.
Current Issues:
- Only supports some limited banks (Empower Retirement and
Wealthfront).
- Only works with the Firefox web browser.
- It might not work if you have multiple accounts at either
of those websites (I have a single account at each and
can't test it).
Here's what you'll need:
- A version of Python installed (I've been using
ActivePython 2.7.14 as that is the version that works
with PocketSense, but my script should work with other
versions).
- Firefox installed and working.
- Your account information for the site you want to
download.
- The appropriate script:
The process:
- GeckoDriver (one-time setup: interfaces between Python's
Selenium and Firefox):
- Download the appropriate GeckoDriver
for your version of Firefox (32-bit or 64-bit).
- Copy it to your Python directory (or anywhere
else in your system path).
- Firefox (one-time setup: create a new profile to store
long-term cookies):
- Open Firefox.
- Navigate to "about:profiles".
- Click "Create a new profile".
- Click "Next" and name your profile
"Selenium". This is a the name of the
software that Python uses to interact with
Firefox.
- Click "Finish".
- Firefox (as often as needed: create your persistent
cookies in the Selenium profile):
- Open Firefox.
- Navigate to "about:profiles".
- Under "Profile: Selenium", click "Launch
profile in a new browser".
- Use this profile to login to your bank as normal.
If your bank uses multi-factor authentication,
this will be how you can receive your text/email
code and enter it.
- Local Scripts:
- Download the appropriate Python script from above
and place it in a local directory.
- Edit the Python file and insert your username and
password for the website into the appropriate
fields. Your username and password are only
stored in this file and then sent to Firefox to
login to your bank.
- Run the script.
- You should see the script launch the
GeckoDriver and then eventually Firefox
will load with a yellow address bar. This
is the Firefox (with the Selenium profile
we created) that will be browsing to your
bank website.
- Your bank page will load, enter your
login, navigate to your OFX/QFX download
page, and download the file to your
current directory.
- After the browser quits, you will have to
manually close the GeckoDriver (this
seems to be a known bug with how Python
terminates processes).
Please contact me if you find this script useful or if you run
into a problem.
shaferandrew@gmail.com
UPDATES:
- 2019-01-23 Initial publication