discount genius

Less expensive than name brand genius.

Theatre Reservation Notifications With Python

Legit

The story

I drive to LA every Wednesday for my Upright Citizens Brigade Improv 101 class.  A requirement for the class and very fun thing to do is take advantage of my student ID and get into various improv shows for free. The one show I can go to without an extra drive up to Hollywood is Cagematch at 11:00 PM on Wednesdays. I checked the site multiple times a day to try to get reservations, but they sold out. I tried the stand-by line and waited an hour in the rain, but there were even people who had reservations who didn’t get in.

The solution

Technology to the rescue! I got home from Los Angeles at about 1:30 AM.  After grabbing a bite to eat, I began writing a script that would check the website regularly and send me a text when the show I was trying to get into was available.  I decided to code it in Python because I’m a beginner at that language, so even if it didn’t work, I would at least get some experience out of it.

(Mom, skip the next paragraph.  It’s pretty technical.)

I inspected the source of various UCB show sites to find a string to check those sites for and researched the best way to have Python send a text for free.  I first tried to send a text to my Verizon phone by sending an email to [phone number]@vtext.com.  After trying libgmail (deprecated) and smtplib (couldn’t get it to work with my current port configurations on my home network or my third party web server), I found pygooglevoice which allows you to log in to Google Voice and send SMS messages.  I had some issues with authentication until I found this fix by bwpayne.  Now we’re in business.  After a number of tests, my program correctly identified shows which were open for reservations, sent me a text, and kept record of the texts it had sent.  I set up a cron job to run it every minute.  I then installed Ringo Lite to my Android phone so that I could set up a custom ringtone for any texts from my Google Voice number.

Victory!

The results

I finally went to bed around 10:00 AM.  At 1:14 PM, the custom ringtone woke me up and I received a text saying that the show was available. At 1:15 PM I had my reservations, and by 1:19 PM the reservations were sold out.  I knew the reservations were going to go fast, but I had no idea they would only be available for five minutes.

The future

I am considering making these text notifications available as a service, possibly in exchange for a fee paid in Bitcoin.  I doubt there’s enough demand for me to even approach turning a profit, but it might be worth it as a learning exercise.  What do you think?  Are there better libraries or techniques I should have used?  What features should be added to improve the functionality of the app?

Comments