Automatically checks for appointment for passport renewals (only) at the Italian Consulate in London, UK.
Pure rage. Getting appointments for passport renewals at the Italian Consulate in London is infamously difficult, with gangs illegally selling appointments at a premium price.
This code checks for availability each 25 seconds and alerts users via SMS as soon as a slot becomes available.
I was able to book an appointment two days after implementing this code.
Frankly, the Italian Consulate should offer this notification service themselves 🤌
MacOS with Chrome
Python 3.8.9
-
On Mac, open Terminal ('CMD + spacebar' and type Terminal), create a folder to hold the project files and access the directory:
mkdir italian_consulate && cd italian_consulate
1.5. Git clone / download this repo.
-
Create a virtual environment for the app to run. I chose to name mine '.italian_consulate'. The dot in front of the name makes the virtual environment isolated from the rest of the system (also makes it invisible):
python3 -m venv .italian_consulate
-
Activate the virtual environment:
. .italian_consulate/bin/activate
-
Install the dependencies from 'requirements.txt' using pip:
pip install -r requirements.txt
-
Open a free trial account with Twilio by following the steps described here: https://www.twilio.com/docs/usage/tutorials/how-to-use-your-free-trial-account
-
This app will need to control Chrome to interact with the Italian Consulate's webpage. In order for it to do so, you'll also need to download a driver for Chrome. Download the driver for your version of Chrome here: https://sites.google.com/a/chromium.org/chromedriver/downloads
Save the driver to the following folder: '/usr/local/bin/'
-
Once logged into your Twilio account, navigate to your console (https://www.twilio.com/console) and select 'Dashboard'.
-
Under 'Project Info', take note of a) your ACCOUNT SID and b) AUTH TOKEN.
-
You'll also need to take note of c) your TWILIO PHONE NUMBER, which can be found by clicking on the three dots on the left of your console page, under the home tab. This number is where the SMS will be sent from. You will also need to have d) your own MOBILE NUMBER.
-
Once you have Twilio's ACCOUNT SID, AUTH TOKEN, TWILIO PHONE NUMBER and MOBILE NUMBER, create an .env file and add your environment variables as follows:
touch .env
This creates an invisible file named ".env" inside /italian_consulate. To see it, hold SHIFT+CMD and click "." (dot). This will show all invisible files. Right-click ".env" and open with a text editor.
In the text editor window, enter these values:
ACC_SID=your_account_sid
AUTH_TOKEN=your_auth_token
TWILIO_NUM=your_twilio_phone_number
MOB_NUM=your_mobile_number
11. Now you'll need to export your login details as environment variables. These are saved to be used each time you get logged out (which happens automatically each couple of hours).
************************************************************************************************* IT'S STRONGLY RECOMMENDED THAT YOU CREATE A UNIQUE LOG IN FOR THIS WEBSITE! I AM NOT RESPONSIBLE FOR ANYTHING THAT GOES WRONG WITH YOUR CREDENTIALS, OR IN CASE OF DATA LEAKS! NOTHING IS HASHED HERE, AND I GAVE VERY LITTLE CONSIDERATION TO SECURITY IN THIS CODE! *************************************************************************************************
export EMAIL="your_email_goes_here"
export PW="your_password_goes_here"
1. In Terminal, with the virtual environment still active (see step 3, above), run the code as follows:
python main.py
- You don't need to do anything else: the app will automatically check for available appointments in the current month and the following two months. It does this every 25 seconds.
If a free slot is found, a voice message will be played in your computer, and you'll receive an SMS. You will then have to login and manually complete the booking directly on the consulate's website.