Helper script in python to monitor dates availabilities in Prefectures and book appointments automatically
- Monitoring RVD dates availability per week per appointment type
- Support list of proxies that allows to avoid
502 Bad Gatewayserver-side throttling (some cheap proxies available on webshare.io). - Sending notification via Telegram Bot
- Automatic captcha validation using anti-captcha.com
- Automatic appointment booking for multiple people in parallel.
To access most of these features you'll need to setup related infrastructure yourself, see the section below.
The script currently requires python 3.6+ and tailored to run on local machine. To install all dependencies run:
$ pip install -r requirements.txtProvide list of proxies to avoid receiving 502 Gateway from prefecture website after several requests in short period. The script has no delay between attempts,
so it's firing requests as soon as possible (~1 second) making it pretty easy to reach. So it's strongly recommend either to add delay (~30 seconds) or add proxies.
100 🇫🇷 proxies could be bought for ~3$ per month from webshare.io (referral link).
- Put proxies in format
host:port(one proxy per line) in./proxies.txt - Set
usernameandpasswordinproxy_config(user_data.py) or leave blank for non-restricted access
Appointment dates often appear at random times and you won't be sitting in from of your computer, so it's having reactive notification system helps a lot. To set up Telegram bot:
- Create bot via
@BothFatherfollowing these instructions. - Update
telegram_bot_tokenwith HTTP API Key (retrieved in previous step) inuser_data.py
Being able to walk away from the computer and have your appointment booked without extra intervention is priceless, while captchas could be easily solved by 3rd party providers, often faster than manually. anti-captcha.com (referral link) provides test credit for free, which is enough to solve 20-40 reCAPTCHAv2. To integrate using their script:
- Register
- Request free credit (~0.05$ per phone number) or buy sufficient credit directly (min 10$) or using one of the resellers (smaller budget).
- Update
anticaptcha_api_keyinuser_data.pyby HTTP API Key
Avoid typing personal data and unblock parallel booking for several users at a time by populating form_data in user_data.py.
You should have an appointment URL which looks like this:
https://www.seine-saint-denis.gouv.fr/booking/create/9846/0
And follow the steps manually at least once to sniff some of the configuration from the Developer Tools, watching for the outgoing AJAX requests that looks like:
https://www.seine-saint-denis.gouv.fr/ezjscore/call/bookingserver::planning::assign::9846::{config.ajax_id}::{week}
To set up polling for this specific example you'll need update the following Config properties in config.py:
url- prefecture website (https://www.seine-saint-denis.gouv.fr)form_id- RVD type (9846)ajax_id- the subtype/giche of the RVD. Could be found when looking at the timetable screens with browser dev-toolsweek_first,week_last- incremental identifier of the week for which you want to get RVD. These IDs very per prefecture and RVD type, same asajax_id
To start polling given prefecture website run from the local machine simply run:
$ python main.py [nb-attempts]Last argument allows to specify how many time to run the check, which is useful for debugging (python main.py 1)
- Register on Docker Hub
- Create an image (1 private image is available with free account)
- Setup any web-hook for Azure/Aws deployment
- Run:
docker image build -t <image name> .
docker push <image name>:<tag-name>