Skip to main content

brooms logo

brooms

PyPI Python 3.11+ License

Book a study room at the University of Bath from Python.

brooms demo, drawn like a sketchbook: a stick-figure student walks around a hand-drawn map of the Bath campus, finds the Library full and 8 West taken while the clock ticks towards 2pm, sits on a bench and opens his laptop, and types a few lines of Python: room cards burst out of the screen, the taken ones fall away, and Norwood House 2.17f gets a BOOKED stamp. Then he runs along a route that draws itself to Norwood House, where the door lights up.
▶️ Watch the video

brooms books rooms. It drives bath.libcal.com, where Bath students book group study rooms, tables and meeting booths in the Library, 1 West, 8 West, East Building, Norwood House and the Virgil Building. No browser needed, so it works in scripts, cron jobs and agents.

Install

pip install brooms

Requires Python 3.11+.

Quick start

from datetime import date, timedelta
from brooms import Brooms

b = Brooms("ab123", "password")                 # your Bath username and password
monday = date.today() + timedelta(days=3)

free = [s for s in b.availability(monday, type="group study room", zone="library")
        if s.available and s.start.hour == 14]
print(free[0].space.name, free[0].start)        # Library 1.12 2026-10-05 14:15:00

booking = b.book(free[0], hours=2)              # 14:15-16:15
b.cancel("https://bath.libcal.com/equipment/cancel?id=...")  # the link from the email

b.spaces() lists every room, table and booth (b.spaces("city") for the Virgil Building), and looking needs no login at all. There's a fuller script in examples/.

Good to know

  • Bookings open 7 days ahead, in 1-hour slots starting at quarter past. A booking can be 1 or 2 hours.
  • Cancelling needs the link from the confirmation email the site sends to your university address. It's the only handle the site gives on a booking, so brooms can't list your bookings either. To automate cancelling, have whatever reads your email (e.g. an agent with a Microsoft 365 connector) pass the link to cancel().
  • Logging in goes through Bath's single sign-on with your username and password, like a browser. Keep them out of your code, e.g. in your OS keychain or environment variables.
  • Rooms, tables and booths only. Study desks are booked a different way and aren't supported yet. Bath's spaces are free; if one ever costs money, book() refuses it.
  • If a booking attempt fails halfway, its slot stays held for about 5 minutes and shows as unavailable until then.

Development

uv sync
uv run pytest              # offline, no account needed
uv run pytest -m live      # read-only checks against the real site, no account needed

See CONTRIBUTING.md and the roadmap.

License

MIT

Metadata

Release files for brooms 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brooms 0.1.1
File Size Uploaded
brooms-0.1.1.tar.gz 53.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brooms 0.1.1
File Interpreter ABI Platform
brooms-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.3 kB

Release files / brooms-0.1.1.tar.gz

Download URL brooms-0.1.1.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9d2c4fac6b4be4b4e6b9077794350d6acdf8358c99a54c64abee7d2afcfa3061
BLAKE2b-256 checksum
How to use checksums
a95fd943106beea924db3f4b28d3721c7f4e137f48fc4313c4124d4dd83d690e
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 2, 2026.

Transparency log

Release files / brooms-0.1.1-py3-none-any.whl

Download URL brooms-0.1.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d9ce898b635748598f09dc0e5874c9cbe0b1ff847236138fdb5e011e7d64dad
BLAKE2b-256 checksum
How to use checksums
d020454f49cf46c4c4cdaf7c37f853d5426bc3020e324ceb57259c7210ab6494
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 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page