watcard is a Python module for working with transaction and balance data from University of Waterloo's Watcard. To access your Watcard's transaction data you must have your student ID and your Watcard PIN. To create/reset your PIN visit http://www.watcard.uwaterloo.ca/account.html
To install watcard:
pip install watcard
Create a new Watcard:
>>> import watcard
>>> w = watcard.Watcard(userid, pin)
Access mealplan and flex balances:
Access transaction records. Optionally filter by account and date. Since tablib Datasets are returned, exporting to JSON, YAML, CSV, HTML, and Excel is easy.
>>> t = w.transactions()
>>> print t.csv
2012-02-11 12:06:15,-1.0,flex,(00608)REV LAUNDRY (DRYE
2012-02-11 12:06:02,-1.0,flex,(00608)REV LAUNDRY (DRYE
Access and filter balance history, which contains the balance at each date. Default interval between dates is a day.
>>> bh = w.balance_history("mealplan")
>>> print bh.csv
>>> w.balance_history("mealplan", start=datetime(...))
>>> w.balance_history("mealplan, coalesce="day")
Calculate the mean daily expenditure for the given period of days.
>>> w.mean(14, account="mealplan")
>>> w.mean(14, account="flex")
Get information on the number of transactions per day of the week and hour.
>>> p = w.punchcard(account="mealplan")
>>> print p.csv
... (one row per hour)
Visualize punchard data:
· Beautiful Soup