Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
Grab Bigpond usage using Python

Telstra Bigpond Usage

A simple python script to grab the current usage from your Telstra Bigpond account.

Dependencies: python-requests

Change the username and password as appropriate

Make the script executable and only accessible to the owner:

 chmod 700

Execute it:

 user@foo:~$ ./
 195.525 / 500 GB
#!/usr/bin/env python2.7
import requests, sys, re
from bs4 import BeautifulSoup
data = {'username': 'steve.smith', 'password': 'somethingsecret!'}
req ='', params=data, allow_redirects=False)
if req.status_code == 302:
cookies = {'BPSESSION': req.cookies['BPSESSION']}
headers = {'Referer': ''}
req = requests.get('', headers=headers, cookies=cookies)
print "Didn't get redirected? ", req.status_code
if req.status_code == 200:
soup = BeautifulSoup(req.text, 'html.parser')
usage = int(soup.find(class_='trStyleTotal').find('b').text) / 1e3
limit = soup.find('th', text="Monthly allowance")'\r\n\t')
limit = re.match('\d+', limit).group()
print usage, "/", limit, "GB"
print "Couldn't get usage page ", req.status_code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment