Skip to main content

Extracts invoices from the TPG website.

Project description

Extracts tax invoices from the TPG Cyberstore (My Account) at the command line.

This is useful for automatically grabbing tax invoices.

This has only been tested with a fixed broadband service. It has not been tested with other products (eg: mobile, dial-up).

This is software is not written or endorsed by TPG.

Installing

The easiest way to install tpg_invoice is:

$ pip3 install tpg_invoice

Manual installation

tpg_invoice requires the following:

* Python 3 (tested on 3.6)
* BeautifulSoup4
* requests

In Debian based distributions, install these packages:

apt install python3 python3-requests python3-bs4

Then run:

./setup.py install

Authentication

tpg_invoice supports authentication with a username and password, or a pre-existing session cookie. One of the mechanisms must be specified.

Authenticating with a username and password

Usage:

$ tpg_invoice -s ~/.config/tpg.secrets

tpg.secrets is a text file, with two lines:

  1. TPG username.
  2. Account password.

An example secrets file is given below, where the username is exampleuser and their password is correcthorsebatterystaple:

exampleuser
correcthorsebatterystaple

Make sure to keep this file only readable by the user which tpg_invoice runs as.

Rate limits apply to the login form, even when login was successful.

Usage

Get invoice list: tpg_invoice list

Usage:

$ tpg_invoice -s tpg.secrets list
Invoice list:

I178018865: raised 2018-01-01, $59.99
I184856374: raised 2018-02-01, $59.99
[...]

Get specific invoice(s): tpg_invoice get I...

Returns a specific invoice as HTML:

$ tpg_invoice -s tpg.secrets get I178018865
<div class="iaspage-area">Tax Invoice Display<table align="RIGHT"><!--/home/database/cgi-bin/inv_disp.cgi:153--><tr><td align="RIGHT">TPG Internet Pty Ltd ABN 15 068 383 737</td></tr><tr><td align="RIGHT">65 Waterloo Rd, MACQUARIE PARK, NSW, 2113</td></tr></table>
[...]

Multiple invoice IDs may be specified at the command line. They will be shown separated by a blank line:

$ tpg_invoice -s tpg.secrets get I178018865 I184856374
<div class="iaspage-area">Tax Invoice Display<table align="RIGHT"><!--/home/database/cgi-bin/inv_disp.cgi:153--><tr><td align="RIGHT">TPG Internet Pty Ltd ABN 15 068 383 737</td></tr><tr><td align="RIGHT">65 Waterloo Rd, MACQUARIE PARK, NSW, 2113</td></tr></table>
[...]

<div class="iaspage-area">Tax Invoice Display<table align="RIGHT"><!--/home/database/cgi-bin/inv_disp.cgi:153--><tr><td align="RIGHT">TPG Internet Pty Ltd ABN 15 068 383 737</td></tr><tr><td align="RIGHT">65 Waterloo Rd, MACQUARIE PARK, NSW, 2113</td></tr></table>
[...]

Get the latest invoice: tpg_invoice get --latest

Returns the latest, non-$0 invoice as HTML:

$ tpg_invoice -s tpg.secrets get --latest
<div class="iaspage-area">Tax Invoice Display<table align="RIGHT"><!--/home/database/cgi-bin/inv_disp.cgi:153--><tr><td align="RIGHT">TPG Internet Pty Ltd ABN 15 068 383 737</td></tr><tr><td align="RIGHT">65 Waterloo Rd, MACQUARIE PARK, NSW, 2113</td></tr></table>
[...]

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
tpg_invoice-0.1.3-py2.py3-none-any.whl (8.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3
tpg_invoice-0.1.3.tar.gz (6.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page