Sunday, December 9, 2012

Automatic monitoring of Verizon shared data plans

This weekend I finally finished(?) the Shared Usage Alerter, my Python set of modules and programs that facilitate monitoring a shared/family plan and alerting its users if someone's going to cause an overage.

Since the last update, I added a bit more infrastructure. Now it's usable by someone with very casual programming skills who has a Verizon shared plan.

The hardest part was writing web-scraping code for Verizon Wireless. VZW actually made it surprisingly easy to get everything once you're logged in to your account: SMS and data usage come as a well-formed XML. But logging in was a chore. I kept getting a different response from Verizon's servers than what a regular browser-based user does, even after providing the same User-Agent. Initially I went down the wrong rabbit hole: I thought the way I manage my cookies is wrong. During login, VZW sets some cookies using Javascript, which requires additional (manual) handling on my part. I spent some time looking for that Javascript code. Well, it turns out the site checks the usually-ignored HTTP Referer header and doesn't permit login if it's different from what the site expects.


Another issue was that Verizon's usage data is not consistent between different accounts. I have credentials to two Verizon accounts, and plan differences require a lot of edge case handling. Unlimited plans, plans that don't actually share, and such. But I have it working for at least two Verizon accounts.

If you have a Verizon share plan and some programming and system administration skill, please try to use this software and give me your feedback. Alternately, I'm happy to run it for you on my system, if you trust me with your account credentials.

No comments:

Post a Comment