This is one of those projects born out of genuine frustration. Our mosque uses an online seat allocation system for major events. Bookings go live at staggered times, but the site is buggy and prone to crashing.

Reverse-engineering the API

The booking system doesn’t have public API documentation, so I started by reverse-engineering it. I spent time inspecting network requests in the browser dev tools and documented the entire API: events, seat allocations, booking, cancellation, and swaps.

The script itself is relatively simple — a Python polling loop that checks every 15 seconds whether booking has gone live. Once it detects that the window is open, it sends notifications via macOS alerts and Mailgun emails so I can jump in and book immediately. It needs my session ID, so I need to login on a browser, take the cookies and then pass that to the script. But, going direct to the API seems to be more stable than doing it via a browser.

I also thought about making it an automatic booker, or more interestingly an automatic booker for my friends and I, making sure we’re sat next to each other. But, maybe a task for next year.

Tech: Python, Mailgun API, macOS notifications.