Python + Mechanize script to scrape Comcast's terrible website for your current bandwidth usage
Switch branches/tags
Nothing to show
Clone or download


#Comcast Bandwidth

This is a script to login to Comcast's website and find your current bandwidth usage. I hate using Comcast's website and this is an easy way to automate that process.

Now, you can setup a cronjob and get daily or weekly stats emailed to you.


  • mid 2012, Comcast appears to have stopped limiting bandwidth usage, see here.

    If you have a note on your bandwidth page: "enforcement of the 250GB data consumption threshold is currently suspended," you probably don't need to worry about your bandwidth usage anymore.


For most OSX/Linux machines, easy_install will install mechanize for you (might require sudo)

easy_install mechanize

##Usage First, you need to create a config.ini file or copy from the config.ini.sample The file should be in following format:

username =
password = PASSWORD

api = KEY

Then run 'python' to get your current bandwidth usage.

Usage: comcastBandwidth [-v[v]] [-w] [--warn-num=NUM] [-a]

-h, --help       show this help message and exit
-v, --verbose    Print status messages to the display
--vv             Print status messages to the display in more detail
-w               Only output if usage above given value  [default: 200gb]
--warn-num=WARN  Max usage before alerting [default: 200gb]
-a, --alert      Sends an alert via Notify My Android

##Cron Usage This script can be setup to only output or send an alert if usage is over 200GB (the -w flag default). Therefore, you can run the script nightly and only get warnings once you get close to limit, for the month.


0 0 * * * /home/askedrelic/code/comcast-bw/ -w

###Warnings With Android Notifications

0 0 * * * /home/askedrelic/code/comcast-bw/ -w -a

##Heroku Usage Don't have a server running 24x7? Run this script for free, once a day, on a Heroku server. See the file

##Anything Broken? I've tested this with my username/account. Comcast's website makes extensive use of "preloading" and redirects, which are stupid and why I hate using it, but I may not have caught every possible combination.

If you run the script with '-v' flag, you can get python logging to figure out where it's broken.

If you run the script with '-vv' flag, you can get mechanize debug for all request/responses and python logging.