teambath
Find a free court at Team Bath without clicking through the booking site.
Want a squash court this week? On bookings.teambath.com that means log in, search, open the activity, and check the grid, one day at a time. Then do it all again for badminton.
teambath does that clicking for you, from Python. It can check courts and classes, and book and cancel free slots.
Install
pip install teambath
Requires Python 3.11+.
Quick start
from datetime import date, timedelta
from teambath import TeamBath
tb = TeamBath("abc123@bath.ac.uk", "1234") # the email and PIN you log in with
tomorrow = date.today() + timedelta(days=1)
free = [s for s in tb.availability("SQUASHFREE2", tomorrow) if s.available]
print(free[0].start, free[0].resource) # 2026-10-01 07:00:00 Squash Court 1
booking = tb.book(free[0])
tb.cancel(booking) # changed your mind
Use tb.search(day, type="squash") to find other activities and their ids, and tb.bookings() to see what you've booked. There are more scripts in examples/.
Good to know
- Only free bookings. If a slot costs anything,
book()backs out and nothing is booked or charged. P.A.Y.G. courts and some fitness classes are paid. - Pick the Students version of an activity (e.g.
SQUASHFREE2). That's the free one with your Sports Pass. - How far ahead you can book depends on the activity: 5 days for free student courts and fitness classes, 1–2 days for swimming, weeks for P.A.Y.G. courts.
- "Not Available" means taken or not released yet. The site doesn't say which.
Development
uv sync
uv run pytest # offline, no account needed
TEAMBATH_EMAIL=... TEAMBATH_PIN=... uv run pytest -m live # read-only checks against the real site
See CONTRIBUTING.md.
License
Metadata
Release files for teambath 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| teambath-0.2.0.tar.gz | 57.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| teambath-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 70.0 kB
Release files / teambath-0.2.0.tar.gz
| Download URL | teambath-0.2.0.tar.gz |
|---|---|
| Size | 57.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de7ba666ceccdb21f56267fc5f6c556f0d55b13a8005ed9f4c7116798d0cdf83
|
|
BLAKE2b-256 checksum How to use checksums |
b31c1d622ee9cf35804707da18bb794d72839017d4fcb46005cff5d163da98ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / teambath-0.2.0-py3-none-any.whl
| Download URL | teambath-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16d3c599b7b46c37968a43503990cba199865121433ab483103f5434c05d53b3
|
|
BLAKE2b-256 checksum How to use checksums |
4c5c6bc922ccd9d490ef14d60da1d52a5ed6711adaa74e0ec748befe09f1910b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log