Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tdack
Last active August 29, 2015 14:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdack/5e8a5c7edfe1857e358a to your computer and use it in GitHub Desktop.
Save tdack/5e8a5c7edfe1857e358a to your computer and use it in GitHub Desktop.
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
bs4

Change the username and password as appropriate

Make the script executable and only accessible to the owner:

 chmod 700 bigpond.py

Execute it:

 user@foo:~$ ./bigpond.py
 195.525 / 500 GB
#!/usr/bin/env python2.7
import requests, sys, re
from bs4 import BeautifulSoup
data = {'username': 'steve.smith', 'password': 'somethingsecret!'}
req = requests.post('https://signon.bigpond.com/login', params=data, allow_redirects=False)
if req.status_code == 302:
cookies = {'BPSESSION': req.cookies['BPSESSION']}
headers = {'Referer': 'https://signon.bigpond.com/login?goto=https%3A%2F%2Fusagemeter.bigpond.com%3A443%2Fdaily.do'}
req = requests.get('https://usagemeter.bigpond.com/daily.do', headers=headers, cookies=cookies)
else:
print "Didn't get redirected? ", req.status_code
sys.exit()
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").parent.td.text.strip('\r\n\t')
limit = re.match('\d+', limit).group()
print usage, "/", limit, "GB"
else:
print "Couldn't get usage page ", req.status_code
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment