Gaming the Gemeente
My son was born in March. We applied for his Dutch residence permit in the first week of April. Once the processing was complete, we were asked to book an appointment to collect the residence permit here. The earliest available date was in October - 6 months later?! Really? I called the Gemeente - i.e - the municipality. They asked me to look out for cancellations.
Here’s a screen recording that shows the steps needed on the website:
It’s basically fastest-finger-first. Will I really have to wait for 5 months?
Maybe not. Coding to the rescue!
I remembered this article from India where scripting was used to book Covid vaccination slots. If not for coding, I would have to check the website every 15 minutes!
I figured...let's give it a shot.
What does my code do?
It opens up a browser window
Goes to the Gemeente URL
Selects the dropdown 'Select a desk' = Amsterdam
Tries to find an available date before October
If a date is found, it emails me, prompting me to book a slot
For people who are interested in the tech behind this, I used:
Selenium’s libraries for browser automation
PhantomJS to work with 'phantom' or browser windows hidden in the background
Mac’s Automator to package the python script into a Mac application
A 3rd party app called Scheduler to schedule the Mac application every 15 minutes
Here’s a snippet of how it works!
If anyone is interested in the code, here's a Github link.
Note: Copy-pasting the code may not work directly for you, as it requires a lot of setup, sorting out python dependencies etc.
The script worked! I got a slot for August! 2 months earlier!
Any questions? Happy to help!!