A Pythonic interface for TfL's Photocard service
Project description
photocard
A Pythonic interface for TfL's Photocard service.
TfL couldn't be bothered to add photocard support to their app, so I made an API for their photocard service in half a day. Not too difficult after all, huh?
Benefits
- Full read access to TfL's Photocard service
- 11-15 Photocard support
Limitations:
- All API endpoints, require logging on.
- All API endpoints are read only
- Limited support for 5-10, 16+, 18+, and 60+ photocards. If you need support for these please provide screenshots of the network inspector calling the card endpoint for these, please open an issue in the issues tab.
CLI
A CLI tool is available.
python -m photocard
Usage
Logon
Logon requires email and password.
Try not to get the password wrong - TfL has been known to lock you out of your account for 30 minutes if you get your password wrong just once.
Example: Getting People & Cards
from photocard import PhotocardService
photocard = PhotocardService()
photocard.logon(input("Enter email: "), input("Enter password: "))
# Gets all people associated with the web account
people = photocard.get_people()
for person in people:
# Get cards for person
cards = photocard.cards_for_person(person) # More than one card can be associated with a person
for card in cards:
print(f"Balance for card {card.oyster_card_number}: £{card.prepaid_balance:.2f}")
# Example output (censored PII): Balance for card 0*********5: £3.50
Disclaimer
This doesn't appear to break any T&C, but I'm not a lawyer, so get one to read TfL's: https://tfl.gov.uk/corporate/terms-and-conditions/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
photocard-0.1.0.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for photocard-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9845d7c116e33622ecac193b42706d742545687e5b8694d9812e5db87ceeee71 |
|
MD5 | 1f33dfbbd86b3a0ac1f832674e24c567 |
|
BLAKE2b-256 | 697e73f62a0a9cb888d54cb4f0365136a7cad318fef9e2266d986d3200120816 |