Why building a ticket monitor requires a state machine, not just a scraper
A developer building MachuPing, an independent monitor for Machu Picchu ticket availability, found that simple web scraping is insufficient for reliable ticket tracking. The core insight is that a small state machine — cycling through states like UNKNOWN, CONFIRMED_UNAVAILABLE, RETURNED_AVAILABLE, and PROVIDER_ERROR — provides a far more robust architecture. Rather than flagging any available slot as an alert, the system only triggers a notification when availability transitions from a previously confirmed unavailable state, reducing false positives. Errors such as timeouts, malformed payloads, and incomplete calendars are treated as observations rather than failures, keeping the machine stable. A typed data structure per attraction, product, date, and party size ensures granular tracking and prevents the common mistake of counting every polling response as a new availability event.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in