Mint.com backup
Mint.com is a great personal finance tool. I started using it once I made the switch to Linux at home. I used to use Quicken, but I really didn't want to configure WINE for that one application. Besides, Quicken is getting really crusty; it looks like it's still the same codebase from the Windows 95 days.
My only gripe with Mint is that your data is "in the cloud". I want a local copy! Mint has a handy link that you can use at the bottom of your transaction list to download a CSV copy. But I wanted to automate it...
Want to backup Mint.com? Here is a quick Python script to download your entire transaction history into a CSV file.import os import urllib import urllib2 import cookielib from optparse import OptionParser import datetime class mintlib(): def __init__(self): self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) # need cookies for the JSESSION ID urllib2.install_opener(self.opener) def login(self, username, password): request = urllib2.Request("https://wwws.mint.com/loginUserSubmit.xevent?task=L", urllib.urlencode(locals())) request.add_header("User-Agent", "Mozilla/5.0") # Mint kicks to a "Upgrade to IE 7.0" page without this response = self.opener.open(request) def download(self, file): # write CSV file of all Mint transactions for this account to a file response = self.opener.open("https://wwws.mint.com/transactionDownload.event?") open(file, "w").write(response.read()) def logout(self): response = self.opener.open("https://wwws.mint.com/logout.event") def getOptions(): arguments = OptionParser() arguments.add_options(["--username", "--password", "--file"]) arguments.set_default("file", "mint_backup_%s.csv" % str(datetime.date.today())) return arguments.parse_args()[0] # options if __name__ == '__main__': options = getOptions() mint = mintlib() mint.login(options.username, options.password) mint.download(options.file) print "Done"The command to run it looks like:
python mint.py --username=foo --password=bar