Checkcards on Github
August 30, 2010 at 11:41 PM by Dr. Drang
My library loan tracking scripts, checkcards and checkcards.py, stopped working this weekend. After a bit of debugging, I came to learn that the library—or, more accurately, its software vendor—had snuck in a new <span> tag at the ends of magazine titles. My Python/BeautifulSoup code wasn’t expecting this and choked on it.1
The fix was fairly simple, but as I was editing checkcards.py, the Python script that does all the heavy lifting, I got a little too aggressive in tearing out the old code and had to reconstruct some of it from memory. It was then that I realized that I’d never put the checkcards scripts under version control. Now I have.
In addition to the README, the GitHub repository has three files:
checkcards.py, which communicates with the library’s website and prepares the email with the list of items checked out and on hold.checkcards, which runscheckcards.pyand pipes the result tosendmailfor emailing.com.leancrew.checkcards.plist, which tellslaunchdto runcheckcardsevery morning.
My login information has been redacted, and the README tells you how to customize it for yourself. Frankly, I doubt that this will be useful to anyone who doesn’t use the Naperville Public Library, but who knows? I think it makes pretty good use of the mechanize library to interact with web pages.
-
I swear this paragraph makes perfect sense. ↩