Download Paychecks from ADP with Python

Posted on 2015-04-05

If your employer uses ADP, you'll know how terrible their website is. I always dread having to go to the website, but I like to download my paychecks every two weeks.

I started playing around with writing a script to download them using Python, but decided I should check Github to see if anyone had already done this. Sure enough, the first result was a script that someone had written that would download all your paychecks.

The script worked perfectly, but there were a few small changes I wanted to make. First, I added a new method that let me easily set the destination path. I also didn't want to have to remember to run this every two weeks, nor did I want a cron job running this script with my password in plain text. I forked the repo, and started incorporating OS X's Keychain to let me store my password securely and running the script once a day to pull down any new paychecks. I borrowed the Keychain library from the alfred-workflow. This lets me easily save and retrieve passwords from Keychain in python. To set my for ADP in Keychain, I used the quick script (you could also do this manually in Keychain.app):

from keychain import KeyChain
import getpass

my_password = getpass.getpass("Enter pw: ")

KeyChain().save_password("my_username", my_password, 'adp')

The script is smart enough to not re-download paychecks that you've already saved, so now it was as simple as adding a new line to my daily cron jobs

python adp.py "my_username"

Lastly, just so that I know when a new paycheck has been added, I set up a small Hazel rule to send me a notification through Pushover whenever a new file is added

adp_hazel

You can see my fork of ADP-paychecks here. You can download a zip of the project here.

Tags: python automation

download-paychecks-from-adp-with-python

© Ryan M 2024. Built using Pelican.