Instantly share code, notes, and snippets.

@tdack tdack/README.md
Last active Aug 29, 2015

Embed
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
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