Screen-scrape ting device usage

Ting offers great inexpensive cellphone service, so when Ingrid's organization needed to provide a cellphone for an employee, I naturally suggested she use them. However, Ting doesn't presently have an API to check usage. So I put together a Python program that can screen-scrape this information.

To use, write a file in ~/.tingrc with your ting username, password, and a list of the device(s) you want to print usage for:

ting_mail = '...@...'
ting_password = '...'
ting_phones = ['...', '...']
If you don't make these settings, you'll be prompted for your ting login credentials each time, and show information about all phones.

Now, just run the program:

$ python ting.py
Phone: Example
	Minutes 30
	Messages 7
	Megabytes 15

Generated in 6.4 seconds
Fri Jan  4 13:41:08 2013

You can do anything you like with the output; I put it at a specific URL, which Ingrid's employee can check to ensure his usage is reasonable.

The script requires Python 2.7, BeautifulSoup 3 (version 4 may work too) and mechanize. I developed it on Linux, so it may not work on other platforms without tweaking.

Not a Ting customer yet? Use my referral code to save yourself $25 on a device (and give me a $25 service credit). Or, if you have a Sprint phone and don't want to part with it, find out whether you can bring your own device.

Files currently attached to this page:

ting.py1.9kB



Entry first conceived on 4 January 2013, 20:37 UTC, last modified on 14 January 2013, 15:00 UTC
Website Copyright © 2004-2017 Jeff Epler