Giter VIP home page Giter VIP logo

doctoshotgun's Introduction

DOCTOSHOTGUN

This script lets you automatically book a vaccine slot on Doctolib in France and in Germany in the next seven days.

Python dependencies

  • woob
  • cloudscraper
  • dateutil
  • termcolor
  • colorama
  • playsound (optional)

How to use it

You need python3 for this script. If you don't have it, please install it first.

Install dependencies:

pip install -r requirements.txt

Run:

./doctoshotgun.py <country{fr,de}> <city> <email> [<password>]

Further optional arguments:

--debug, -d           show debug information
--pfizer, -z          select only Pfizer vaccine
--moderna, -m         select only Moderna vaccine
--janssen, -j         select only Janssen vaccine
--astrazeneca, -a     select only AstraZeneca vaccine
--only-second, -2     select only second dose
--only-third, -3      select only third dose
--patient PATIENT, -p PATIENT
                      give patient ID
--time-window TIME_WINDOW, -t TIME_WINDOW
                      set how many next days the script look for slots (default = 7)
--center CENTER, -c CENTER
                      filter centers
--zipcode CODE
                      filter centers by zipcode
--center-regex CENTER_REGEX
                      filter centers by regex
--center-exclude CENTER_EXCLUDE, -x CENTER_EXCLUDE
                      exclude centers
--center-exclude-regex CENTER_EXCLUDE_REGEX
                      exclude centers by regex
--include-neighbor-city, -n
                      include neighboring cities
--start-date START_DATE
                      first date on which you want to book the first slot (format should be DD/MM/YYYY)
--end-date END_DATE   last date on which you want to book the first slot (format should be DD/MM/YYYY)
--weekdays-exclude, -e
                      exclude weekdays, e.g. "tuesday Wednesday FRIDAY"
--dry-run             do not really book the slot
--code CODE           2FA code
--confirm             prompt to confirm before booking

With Docker

Build the image:

docker build . -t doctoshotgun

Run the container:

docker run -it doctoshotgun <country{fr,de}> <city> <email> [<password>]

Multiple cities

You can also look for slot in multiple cities at the same time. Cities must be separated by commas:

$ ./doctoshotgun.py <country{fr,de}> <city1>,<city2>,<city3> <email> [<password>]

Filter on centers

You can give name of centers in which you want specifically looking for:

$ ./doctoshotgun.py fr paris [email protected] \
      --center "Centre de Vaccination Covid 19 - Ville de Paris" \
      --center "Centre de Vaccination du 7eme arrondissement de Paris - Gymnase Camou"

Select patient

For doctolib accounts with more thant one patient, you can select patient just after launching the script:

$ ./doctoshotgun.py fr paris [email protected] PASSWORD
Available patients are:
* [0] Roger Philibert
* [1] Luce Philibert
For which patient do you want to book a slot?

You can also give the patient id as argument:

$ ./doctoshotgun.py fr paris [email protected] PASSWORD -p 1
Starting to look for vaccine slots for Luce Philibert in 1 next day(s) starting today...

Set time window

By default, the script looks for slots between now and next day at 23:59:59. If you belong to a category of patients that is allowed to book a slot in a more distant future, you can expand the time window. For exemple, if you want to search in the next 5 days :

$ ./doctoshotgun.py fr paris [email protected] -t 5
Password:
Starting to look for vaccine slots for Roger Philibert in 5 next day(s) starting today...
This may take a few minutes/hours, be patient!

Look on specific date

By default, the script looks for slots between now and next day at 23:59:59. If you can't be vaccinated right now (e.g covid in the last 3 months or out of town) and you are looking for an appointment in a distant future, you can pass a starting date:

$ ./doctoshotgun.py fr paris [email protected] --start-date 17/06/2021
Password:
Starting to look for vaccine slots for Roger Philibert in 7 next day(s) starting 17/06/2021...
This may take a few minutes/hours, be patient!

Filter by vaccine

The Pfizer vaccine is the only vaccine allowed in France for people between 16 and 18. For this case, you can use the -z option.

$ ./doctoshotgun.py fr paris [email protected] PASSWORD -z
Starting to look for vaccine slots for Luce Philibert...
Vaccines: Pfizer
This may take a few minutes/hours, be patient!

It is also possible to filter on Moderna vaccine with the -m option and Janssen with the -j option.

Development

Running tests

 $ pip install -r requirements-dev.txt
 $ pytest test_browser.py

doctoshotgun's People

Contributors

aduffeck avatar alexislg2 avatar bokub avatar clemux avatar cterence avatar cvermot avatar danburg avatar dettorer avatar edwillys avatar erdnaxeli avatar gitolicious avatar hista avatar mpascucci avatar nicogodet avatar nicolaus-hee avatar r00tk1d avatar raphaelmeudec avatar rbignon avatar remicmacs avatar romaiiiinnn avatar romuald avatar seranpion avatar thomasparistech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doctoshotgun's Issues

Script books a slot which is only allowed for returning patients

This is a tricky one. A certain doctor in Germany (Praxis am Ebertplatz - Hausärzte | Infektiologen) limits a certain vaccination (BioNTech-Pfizer) to patients that have already been to that doctor before. On the web page it looks like this:
image
(First question loosely translates to "Have you been to this doctor before? [yes / no]". The last two items in the "motive" selection are greyed out and not selectable if you chose "no")

The script seems to ignore this (tried with --dry-run).

Center Praxis am Ebertplatz - Hausärzte | Infektiologen:
– Praxis am Ebertplatz...
  Vaccine Pfizer... found!
  ├╴ Best slot found: Fri Jun 18 14:00:00 2021
  ├╴ Second shot: Fri Jul 30 17:45:00 2021
  ├╴ Booking for John Doe...
  └╴ Booking status: fake

💉 Booked! Congratulations.

I would guess the doctor will reject the booking as from his point of view it is based on false information. Any chance to detect this and skip booking the slot?

Erreur de syntaxe

J'ai un erreur sur la ligne 304:
print('%s (%s):' % (field['label'], field['placeholder']), end=' ', flush=True)
^
SyntaxError: invalid syntax

Namespace Gst not available

I've been getting this error today when a booking slot was available (with multiple doctors):

  Vaccine Janssen... found!
  ├╴ Best slot found: Fri Jun 18 17:39:00 2021
An unexpected exception of type ValueError occurred. Arguments:
('Namespace Gst not available',)

Is this an issue with doctoshotgun or am I missing a dependency?

missing city if both motive_ids 6970 and 7005

Bonjour,

Tout d'abord un grand merci pour ton script,

J'ai essayé de booker un créneau pour Puteaux mais j'ai l'impression que le script n'obtient jamais le centre de la ville dans ses résultats de recherches, alors que je le vois en tête des résultats sur l'url de mon navigateur :
https://www.doctolib.fr/vaccination-covid-19/puteaux?ref_visit_motive_ids[]=6970&ref_visit_motive_ids[]=7005

Et là plus étonnant, si j'inverse les ids 6970/7005 de la première requête de la méthode find_centers, le cabinet est trouvé (Trying to find a slot in Centre de Vaccination Covid-19 de Puteaux).

Je ne sais pas si je suis très clair, et je ne suis pas très bon en Python, mais peut être qu'il y a une explication derrière...

Book specific Doctor/Center

Is it possible to filter on a specific center even if this center is not in the list of centers that offer vaccination?

We have several doctors that are not listed under the keyword "vaccination covid-19" but they offer appointments for that in doctolib.

Would it be possible to add an option to specify a particular Doctor-ID where I want to book?

not enough arguments for format string

Hello,
merci pour le script franchement. En revanche, j'ai un soucis, au moment de trouver un créneau, ça me renvoit "not enough arguments for format string".
Précision je suis sous Windows 10 avec Python 3.9
bug-doctoshotgun
Merci

Suggestion: Recherche par code postal

Bonjour, l'application ne semble pas accepter les recherches par codes postaux.
Cela serait utile notamment pour Paris. Le site web, en revanche accepte ce type de recherche.
Merci!

NB: Merci pour cette app, cella me permet de decouvrir les libraries woob et cloudscraper qui semblent tres prometteuses.

"Spécifiez votre situation ():" question before booking

I have tried to book a 3rd dose with the following parameters:

./doctoshotgun.py fr chaville <EMAIL> -p 0 -n -3

After a few minutes, doctoshotgun found a slot :

Center Centre de Vaccination COVID-19 de la Ville de Clamart (Clamart):
– Centre de vaccination Covid-19 de la ville de Clamart...
  Vaccine 3e.*Pfizer... found!
  ├╴ Best slot found: Thu Nov 25 11:00:00 2021
  ├╴ Booking for Alexis LE GOFF...
Spécifiez votre situation ():

What am I supposed to answer?

OBTENIR UNE ERREUR WRONG LOGIN / PASSWORD AVEC UN MOT DE PASSE CORRECT

Hi! I am executing the following command on CMD:/Salut! J'exécute la commande suivante sur CMD:

C:\Users\username>python doctoshotgun.py paris [email protected]

and i get back Password: /et je récupère le mot de passe:

i can't see what i am typing but i keep on getting wrong login/password even if i input the right password/Je ne vois pas ce que je tape mais je continue à me tromper de login / mot de passe même si j'entre le bon mot de passe

Would you know how to fix this? Sauriez-vous comment résoudre ce problème?

thx a lot in advance!

Feature to restrict the search area

It would be great to add a feature to restrict the search area or to exclude some vaccination centers.

I looked for an appointment to Bordeaux, and doctoshotgun booked at Marmande, 100km from Bordeaux:

./doctoshotgun.py bordeaux login password
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.doctolib.fr:443                                                                                                                                                                                                      
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /vaccination-covid-19/bordeaux?ref_visit_motive_ids%5B%5D=7005 HTTP/1.1" 200 None                                                                                                                                          
INFO:browser:Response saved to c7ec8cfd3ef64c8ebe98c0fd22f522f5                                                                                                                                                                                                                          
DEBUG:browser:Handle https://www.doctolib.fr/vaccination-covid-19/bordeaux?ref_visit_motive_ids%5B%5D=7005 with CentersPage                                                                                                                                                              
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5031135.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None                                                                                   
INFO:browser:Response saved to c2f3bb1ac4d141f7803c35e8dbfa381a                                                                                                                                                                                                                          
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5031135.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage                                                                                                  
::: Trying to find a slot in Centre de vaccination Covid-19 - Hôpital Robert Picqué                                                                                                                                                                                                      
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /sessions/new HTTP/1.1" 200 None                                                                                                                                                                                           
INFO:browser:Response saved to e49f651f0b5443b2966214481fe345e9                                                                                                                                                                                                                          
DEBUG:browser:Unable to handle https://www.doctolib.fr/sessions/new                                                                                                                                                                                                                      
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "POST /login.json HTTP/1.1" 200 None                                                                                                                                                                                            
INFO:browser:Response saved to 21c89c5e96a94724a9251b918b7270c7
DEBUG:browser:Handle https://www.doctolib.fr/login.json with LoginPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /hopital-public/villenave-d-ornon/centre-de-vaccination-covid-19-hopital-robert-picque?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to 93b627e0d68545b294832e35453d7cf0
DEBUG:browser:Unable to handle https://www.doctolib.fr/hopital-public/villenave-d-ornon/centre-de-vaccination-covid-19-hopital-robert-picque?highlight%5Bspeciality_ids%5D%5B%5D=5494
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/centre-de-vaccination-covid-19-hopital-robert-picque.json HTTP/1.1" 200 None
INFO:browser:Response saved to 011d5c811549400cbf28adae12e73ce1
DEBUG:browser:Handle https://www.doctolib.fr/booking/centre-de-vaccination-covid-19-hopital-robert-picque.json with CenterBookingPage
::: Looking for slots in place Hôpital d'Instruction des Armées Robert Picqué - Centre de vaccination
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2691628&agenda_ids=446169-446166-446165-446167-449070-437054-449075-449076-449073&insurance_sector=public&practice_ids=180153&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to e42ab2b916064087a1a5583240974d90
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2691628&agenda_ids=446169-446166-446165-446167-449070-437054-449075-449076-449073&insurance_sector=public&practice_ids=180153&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: No availabilities in this center
::: Fail, try next center...
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5041671.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None
INFO:browser:Response saved to 14e2dcf9a05b41c8988feef3c3f12feb
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5041671.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage
::: Trying to find a slot in Centre de vaccination Covid-19 - Saint-Médard-en-Jalles
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /centre-de-sante/saint-medard-en-jalles/centre-de-vaccination-covid-19-saint-medard-en-jalles?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to 44564734a13a40c1b835caa2b009308a
DEBUG:browser:Handle https://www.doctolib.fr/centre-de-sante/saint-medard-en-jalles/centre-de-vaccination-covid-19-saint-medard-en-jalles?highlight%5Bspeciality_ids%5D%5B%5D=5494 with CenterPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/centre-de-vaccination-covid-19-saint-medard-en-jalles.json HTTP/1.1" 200 None
INFO:browser:Response saved to 0fdf951da2bd4c4aa13ff3389098ac0b
DEBUG:browser:Handle https://www.doctolib.fr/booking/centre-de-vaccination-covid-19-saint-medard-en-jalles.json with CenterBookingPage
::: Looking for slots in place Centre de vaccination Covid-19 - St Médard-en-Jalles [Club-house du complexe sportif Robert Monseau]
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2729640&agenda_ids=473316-468426-446149-446148-446147-446146-446145&insurance_sector=public&practice_ids=179381&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 51c9080db245432c8460f0ff809bb9d1
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2729640&agenda_ids=473316-468426-446149-446148-446147-446146-446145&insurance_sector=public&practice_ids=179381&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: No availabilities in this center
::: Fail, try next center...
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5046942.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None
INFO:browser:Response saved to e0a2ed3244a643b98d0d7b9e4c6d6014
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5046942.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage
::: Trying to find a slot in Centre de vaccination COVID-19 Margaux-Cantenac
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /centre-de-sante/margaux-cantenac/centre-de-vaccination-covid-19-margaux-cantenac?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to eb146ceb9e3d45ab9985b6813b85b715
DEBUG:browser:Handle https://www.doctolib.fr/centre-de-sante/margaux-cantenac/centre-de-vaccination-covid-19-margaux-cantenac?highlight%5Bspeciality_ids%5D%5B%5D=5494 with CenterPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/centre-de-vaccination-covid-19-margaux-cantenac.json HTTP/1.1" 200 None
INFO:browser:Response saved to c5352c3181a245d580b8dbed5faba0cc
DEBUG:browser:Handle https://www.doctolib.fr/booking/centre-de-vaccination-covid-19-margaux-cantenac.json with CenterBookingPage
::: Looking for slots in place CENTRE DE VACCINATION COVID-19 MARGAUX-CANTENAC
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2751283&agenda_ids=451410-451399-451402-451401&insurance_sector=public&practice_ids=181150&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 17f289fd53884ca283c37945de378cb4
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2751283&agenda_ids=451410-451399-451402-451401&insurance_sector=public&practice_ids=181150&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: No availabilities in this center
::: Fail, try next center...
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5341699.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None
INFO:browser:Response saved to 69d9d5cfce20459f9be7cea6ea91b4da
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5341699.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage
::: Trying to find a slot in Centre de vaccination Covid-19 - Biganos
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /centre-de-vaccinations-internationales/biganos/centre-de-vaccination-covid-19-biganos?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to 614f545eb0bd43b88dcc3fe9080d9708
DEBUG:browser:Unable to handle https://www.doctolib.fr/centre-de-vaccinations-internationales/biganos/centre-de-vaccination-covid-19-biganos?highlight%5Bspeciality_ids%5D%5B%5D=5494
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/centre-de-vaccination-covid-19-biganos.json HTTP/1.1" 200 None
INFO:browser:Response saved to 1a105a64feae45a399cf19f7ce7e6b4f
DEBUG:browser:Handle https://www.doctolib.fr/booking/centre-de-vaccination-covid-19-biganos.json with CenterBookingPage
::: Looking for slots in place Centre de Vaccination Covid-19 - Moderna - Salle des fêtes de Biganos
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2621761&agenda_ids=468075-426297-424941&insurance_sector=public&practice_ids=171118&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 5b5f81dc705842738c40eca655f94be5
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2621761&agenda_ids=468075-426297-424941&insurance_sector=public&practice_ids=171118&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: No availabilities in this center
::: Fail, try next center...
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5341708.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None
INFO:browser:Response saved to a85d2ddeca9c4eb1aea346a4550cd809
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5341708.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage
::: Trying to find a slot in Centre de Vaccination Covid-19 Nord Bassin - Ville d'Arès
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /centre-de-sante/ares/centre-de-vaccination-covid-19-nord-bassin-ville-d-ares?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to 5e4e07e987bd464da873b19487c87400
DEBUG:browser:Handle https://www.doctolib.fr/centre-de-sante/ares/centre-de-vaccination-covid-19-nord-bassin-ville-d-ares?highlight%5Bspeciality_ids%5D%5B%5D=5494 with CenterPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/centre-de-vaccination-covid-19-nord-bassin-ville-d-ares.json HTTP/1.1" 200 None
INFO:browser:Response saved to 474e2150be874841a0e160e43555990d
DEBUG:browser:Handle https://www.doctolib.fr/booking/centre-de-vaccination-covid-19-nord-bassin-ville-d-ares.json with CenterBookingPage
::: Looking for slots in place Centre de vaccination Covid-19 - Nord Bassin Arès
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to d42527c864064f90a7e57b9239af0910
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 with AvailabilitiesPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-20&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 1fdb1d4158bc41e4a00e658680f683e9
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-20&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 with AvailabilitiesPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-27&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 19c5c21878604eafb07ddd84bc7fcff7
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-27&visit_motive_ids=2629258&agenda_ids=435161-426349-426346-440577-441807-441809-441806-441808-426348-426344-435160-426345&insurance_sector=public&practice_ids=171900&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: First slot not found :(
::: Fail, try next center...
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /search_results/5368669.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json HTTP/1.1" 200 None
INFO:browser:Response saved to 0d0d5cb1d791492c839c3fb8a002207f
DEBUG:browser:Handle https://www.doctolib.fr/search_results/5368669.json?limit=4&ref_visit_motive_ids%255B%255D=7005&speciality_id=5494&search_result_format=json with CenterResultPage
::: Trying to find a slot in Vaccination Covid 19 - Centre Hospitalier Intercommunal Marmande Tonneins
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /centre-de-vaccinations-internationales/marmande/ch-intercommunal-marmande?highlight%5Bspeciality_ids%5D%5B%5D=5494 HTTP/1.1" 200 None
INFO:browser:Response saved to 3e9bac1db2c841b1a1b3eebde7378deb
DEBUG:browser:Unable to handle https://www.doctolib.fr/centre-de-vaccinations-internationales/marmande/ch-intercommunal-marmande?highlight%5Bspeciality_ids%5D%5B%5D=5494
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /booking/ch-intercommunal-marmande.json HTTP/1.1" 200 None
INFO:browser:Response saved to 7f717749e27c44d397476432796515c0
DEBUG:browser:Handle https://www.doctolib.fr/booking/ch-intercommunal-marmande.json with CenterBookingPage
::: Looking for slots in place Centre de Vaccination COVID
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /availabilities.json?start_date=2021-05-16&visit_motive_ids=2536400&agenda_ids=460983-473300-473299-460984-460987&insurance_sector=public&practice_ids=163177&destroy_temporary=true&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 316317037c6e4abebf95c4f8d7e09bf9
DEBUG:browser:Handle https://www.doctolib.fr/availabilities.json?start_date=2021-05-16&visit_motive_ids=2536400&agenda_ids=460983-473300-473299-460984-460987&insurance_sector=public&practice_ids=163177&destroy_temporary=true&limit=3 with AvailabilitiesPage
::: Better slot found: Mon May 17 14:45:00 2021
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "POST /appointments.json HTTP/1.1" 200 None
INFO:browser:Response saved to b344bfb3f9f949418e8de0ec8f6ddc33
DEBUG:browser:Handle https://www.doctolib.fr/appointments.json with AppointmentPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /second_shot_availabilities.json?start_date=2021-06-25&visit_motive_ids=2536400&agenda_ids=460983-473300-473299-460984-460987&first_slot=2021-05-17T14%3A45%3A00.000%2B02%3A00&insurance_sector=public&practice_ids=163177&limit=3 HTTP/1.1" 200 None
INFO:browser:Response saved to 44fa6166b0ce4df48890ee2b6b505a23
DEBUG:browser:Handle https://www.doctolib.fr/second_shot_availabilities.json?start_date=2021-06-25&visit_motive_ids=2536400&agenda_ids=460983-473300-473299-460984-460987&first_slot=2021-05-17T14%3A45%3A00.000%2B02%3A00&insurance_sector=public&practice_ids=163177&limit=3 with AvailabilitiesPage
::: Second shot: Fri Jun 25 16:15:00 2021
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "POST /appointments.json HTTP/1.1" 200 None
INFO:browser:Response saved to 8f145b13a1db4b3db9b4c7dfa5c5e487
DEBUG:browser:Handle https://www.doctolib.fr/appointments.json with AppointmentPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984/edit.json HTTP/1.1" 200 None
INFO:browser:Response saved to ce196a3fc3be451ab5df87425de09dab
DEBUG:browser:Handle https://www.doctolib.fr/appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984/edit.json with AppointmentEditPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /account/master_patients.json HTTP/1.1" 200 None
INFO:browser:Response saved to 3af4c06433f54d778109e7a66a917292
DEBUG:browser:Handle https://www.doctolib.fr/account/master_patients.json with MasterPatientPage
::: Booking for you
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984/edit.json?master_patient_id=13489667 HTTP/1.1" 200 None
INFO:browser:Response saved to 4835cf949f4c4bb6bc1668110d2d9b67
DEBUG:browser:Handle https://www.doctolib.fr/appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984/edit.json?master_patient_id=13489667 with AppointmentEditPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "PUT /appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984.json HTTP/1.1" 200 None
INFO:browser:Response saved to f41d6d18fce8435bbec3885dc5552d6e
DEBUG:browser:Handle https://www.doctolib.fr/appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984.json with AppointmentPostPage
::: Go on https://www.doctolib.fr/confirmed-appointment/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984.json HTTP/1.1" 200 None
INFO:browser:Response saved to bccd9b20b02947a596f78c7433d8b464
DEBUG:browser:Handle https://www.doctolib.fr/appointments/2453610620-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMjQ1MzYxMDYyMD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--6ba2faf1917578f9577edf628d6279a05a9cd984.json with AppointmentPostPage
::: Booking status: True
::: Booked!

ModuleNotFoundError: No module named 'AppKit'

Description

When a center with available slot is found, I encountered a ModuleNotFoundError

Stacktrace

Here is the last bit of the trace:

Center Centre de vaccination covid-19 - Centre Henry Dunant:
– Centre Henry Dunant - Croix Rouge Française... first slot not found :(

Center Centre de vaccination COVID-19 - Gymnase Henry de Montherlant - Paris 16:
– Gymnase Henry de Montherlant... found!
  ├╴ Best slot found: Fri May 28 09:45:00 2021
Traceback (most recent call last):
  File "./doctoshotgun.py", line 468, in <module>
    sys.exit(Application().main())
  File "./doctoshotgun.py", line 454, in main
    if docto.try_to_book(center):
  File "./doctoshotgun.py", line 252, in try_to_book
    if self.try_to_book_place(profile_id, motive_id, practice_id, agenda_ids):
  File "./doctoshotgun.py", line 306, in try_to_book_place
    playsound('ding.mp3')
  File "./doctoshotgun.py", line 30, in playsound
    return _playsound(*args)
  File "/Users/me/.virtualenvs/docto/lib/python3.8/site-packages/playsound.py", line 55, in _playsoundOSX
    from AppKit     import NSSound
ModuleNotFoundError: No module named 'AppKit'

Environment

macOS 11.3
Python 3.8.2
pip 21.1

Pull requests are piling up, @rbignon still active?

Hi @rbignon, I just wanted to check in with you as pull requests are piling up without being reviewed.
If you need some help maintinig the repo, don't hesitate to give a shout to the community. I am sure there are people who are happy to help out.
Big thanks for the initial idea and your contributions so far! I learned a lot on Python web scraping through this and already got my first vaccination shot.

Some motive regexes do not cover all labels

Hello.

I noticed that some centers display unusual labels for the 3rd dose motive.
Here is an example (there are others too):
image

I suppose we should update the regex configuration (either make regex lists or enrich the existing ones, e.g. (3e|troisième).*Moderna).

What do you think?

Nouvelles règles

À partir du 31 mai, la prise de rendez-vous est ouverte à tout le monde sans limite en France. De fait j'ai modifié le script pour chercher par défaut le rendez-vous le plus proche dans les sept prochains jours.

Néanmoins, je ne sais pas exactement quelle serait l'attente des utilisateurs. Est-ce que par exemple il faudrait exclure le jour-même ? Est-ce qu'on rajoute une option pour définir un délai minimum ? Est-ce qu'on en profite pour rajouter des filtres supplémentaires (plage horaire) ?

Semble non compatible avec windows

Lorsque je lance: "doctoshotgun.py paris username_email" de mon environemment venv, j'obtiens l'erreur suivante:
" from dateutil.parser import parse as parse_date
ModuleNotFoundError: No module named 'dateutil'
"
si je lance la commande du "./doctoshotgun.py paris username_email", l'erreur est:
"'.' is not recognized as an internal or external command,
operable program or batch file.
"
Comment faire fonctionner ce programme sous windows?
Merci

ServerError: 503 Server Error: Service Temporarily Unavailable

Traceback (most recent call last):
File "C:\perso\tools\docto\doctoshotgun.py", line 506, in
sys.exit(Application().main())
File "C:\perso\tools\docto\doctoshotgun.py", line 433, in main
if not docto.do_login():
File "C:\perso\tools\docto\doctoshotgun.py", line 192, in do_login
self.open('https://www.doctolib.fr/sessions/new')
File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\woob\browser\browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\woob\browser\browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\woob\browser\browsers.py", line 531, in open
response = self.session.send(preq,
File "C:\perso\tools\docto\doctoshotgun.py", line 57, in send
return callback(self, resp)
File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\woob\browser\browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\woob\browser\browsers.py", line 563, in raise_for_status
raise ServerError(http_error_msg, response=response)
woob.browser.exceptions.ServerError: 503 Server Error: Service Temporarily Unavailable

No third shot vaccinations in this country

Hey,
great repo!

I tried to book a third shot with it but always get the error that there is no third shot available in germany/berlin.
Is repo outdated or am I doing something wrong?

Cheers!

Will the script work with the new Doctolib queuing system?

Currently when I run the script I have the following message on loop:

This may take a few minutes/hours, be patient!
[2021-11-25 18:44:35]
No free slots found at selected centers. Trying another round in 5 sec...
[2021-11-25 18:44:40]
No free slots found at selected centers. Trying another round in 5 sec...
[2021-11-25 18:44:45]
No free slots found at selected centers. Trying another round in 5 sec...

...

I tried debugging, and saw that the url being requested ends up on a queuing system.

image

I guess that if we keep pinging this url, it will always fall back at the back of the queue.

Maybe fortunately with the new queuing system this script is not needed anymore, let's see.

Script won't work with double auth connection

English

As mentioned in issue #37

When manually signing in you'd have to enter your mail address and password and then would be redirected to https://www.doctolib.fr/sessions/two-factor where you have to enter the 6 digit code you've been sent.
When this is done I suppose you get a cookie that allows the server to know if the computer is new or not.

When executed in the script, after connection it ll try to access a page that require you to be logged in. Which is not the case with double auth thus the error 401 sended by the script

Français

Comme mentionné dans l'issue #37

Si l'on a la double authentification voilà ce qu'il se passe

Dans une navigation 'normale' on est redirigé vers https://www.doctolib.fr/sessions/two-factor et dans le même temps on reçoit un code à 6 chiffres à saisir sur cette page.
#37 (comment)

Ensuite la session peut être accéder grâce à un cookie.

Or dans le script on est directement dirigé vers une page qui demande d'être connecté et provoque l'erreur 401

[FEATURE REQUEST] Iterate through the pages if more than 1

The current script doesn't look up on the second (or more) pages of results, but only on the first one. This means it will potentially miss appointments slots if they are from doctors in the second page.

There is a button at the bottom of the page indicating if there's a next page, which can be accessed doing something like self.doc.xpath('//div[@class="next dl-rounded-borders dl-white-bg"]'): and then checking if the children <a> exists and has a valid href.
image

I was not able to make this work by proceeding to that page through the regular loop, so I hacked it and updated the params in this line to include 'page': 2 and running the script on a different shell.

Considering that we know if there's a next page, and I know that the script works fine on that page, I hope that someone who understands a bit more this code is able to put it together to have that as part of the regular script :)

Error 401

Bonjour,
Merci beaucoup pour votre travail sur ce projet.

Je reçois une erreur 401 lors du lancement du script.

Voici le contenu de mon terminal (avec l'option -d pour debug) :
./doctoshotgun.py -d Paris [email protected]
Password:
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.doctolib.fr:443
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /sessions/new HTTP/1.1" 200 None
INFO:browser:Response saved to 677dad1389174096842e851184a51d4a
DEBUG:browser:Unable to handle https://www.doctolib.fr/sessions/new
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "POST /login.json HTTP/1.1" 200 None
INFO:browser:Response saved to 0e2f596a8ebd4e27949d4743235cc5c5
DEBUG:browser:Handle https://www.doctolib.fr/login.json with LoginPage
DEBUG:urllib3.connectionpool:https://www.doctolib.fr:443 "GET /account/master_patients.json HTTP/1.1" 401 None
INFO:browser:Response saved to 869a22057d7146148592bdd36c2b2e09
Traceback (most recent call last):
File "/Users/Victor/Documents/Programmation/Python/doctoshotgun/./doctoshotgun.py", line 420, in
sys.exit(Application().main())
File "/Users/Victor/Documents/Programmation/Python/doctoshotgun/./doctoshotgun.py", line 378, in main
patients = docto.get_patients()
File "/Users/Victor/Documents/Programmation/Python/doctoshotgun/./doctoshotgun.py", line 207, in get_patients
self.master_patient.go()
File "/usr/local/lib/python3.9/site-packages/woob/browser/url.py", line 98, in go
r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 911, in location
response = self.open(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 531, in open
response = self.session.send(preq,
File "/Users/Victor/Documents/Programmation/Python/doctoshotgun/./doctoshotgun.py", line 42, in send
return callback(self, resp)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 560, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 401 Client Error: Unauthorized

Je suis sur Mac OS X. Avez-vous une idée de ce qui pourrait causer le problème ?

Crash sur une erreur 503

Lorsque que la page ne charge pas, le programme s'arrête. Pas pratique car je souhaite le laisser en tourner en continu:

File "/usr/local/lib/python3.7/dist-packages/woob/browser/browsers.py", line 539, in open is_async=is_async) File "./doctoshotgun.py", line 41, in send return callback(self, resp) File "/usr/local/lib/python3.7/dist-packages/woob/browser/browsers.py", line 527, in inner_callback self.raise_for_status(response) File "/usr/local/lib/python3.7/dist-packages/woob/browser/browsers.py", line 563, in raise_for_status raise ServerError(http_error_msg, response=response) woob.browser.exceptions.ServerError: 503 Server Error: Service Temporarily Unavailable

Anyone else getting this error?

Traceback (most recent call last):
File "/app/doctoshotgun.py", line 590, in
sys.exit(Application().main())
File "/app/doctoshotgun.py", line 510, in main
patients = docto.get_patients()
File "/app/doctoshotgun.py", line 231, in get_patients
self.master_patient.go()
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/url.py", line 98, in go
r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 911, in location
response = self.open(*args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 531, in open
response = self.session.send(preq,
File "/app/doctoshotgun.py", line 59, in send
return callback(self, resp)
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "/app/.heroku/python/lib/python3.9/site-packages/woob/browser/browsers.py", line 560, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 401 Client Error: Unauthorized

Read Time Out

Hello,

Thank you for your code. Unfortunately it gives me a timeout.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='www.doctolib.de', port=443): Read timed out. (read timeout=10.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./doctoshotgun.py", line 485, in <module>
    sys.exit(Application().main())
  File "./doctoshotgun.py", line 470, in main
    if docto.try_to_book(center):
  File "./doctoshotgun.py", line 268, in try_to_book
    if self.try_to_book_place(profile_id, motive_id, practice_id, agenda_ids):
  File "./doctoshotgun.py", line 276, in try_to_book_place
    self.availabilities.go(params={'start_date': date,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/woob/browser/url.py", line 98, in go
    r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/woob/browser/browsers.py", line 911, in location
    response = self.open(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/woob/browser/browsers.py", line 898, in open
    return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/woob/browser/browsers.py", line 790, in open
    return super(DomainBrowser, self).open(req, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/woob/browser/browsers.py", line 531, in open
    response = self.session.send(preq,
  File "./doctoshotgun.py", line 44, in send
    resp = super().send(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='www.doctolib.de', port=443): Read timed out. (read timeout=10.0)`

How can I fix this?

password ??

Which password is required when running the script? the email password?

Are we getting too many CLI arguments?

The current master branch scipt already has 14 CLI arguments. With the currently open PRs (#81, #83) it will be at least five more and I have plenty more in my mind. Looks like this is slowly getting out of hand. Should we switch to a config file? Any other ideas? Or just keep them coming?

Format des disponibilités

Dans certains cas le format des créneaux de disponibilité n'est pas celui attendu.

self.doc['availabilities']['slots'][-1]

n'est pas un dictionnaire mais une chaîne de caractère.
Par exemple, un élément de availabilities peut avoir ce contenu:

{'date': '2021-05-22', 'slots': ['2021-05-22T09:30:00.000+02:00'], 'substitution': None}

local variable 'slot_date_second' referenced before assignment

I was running the script as always (default settings in Germany) when a Pfizer vaccination showed up. Unfortunately it crashed with local variable 'slot_date_second' referenced before assignment.

Center Gemeinschaftspraxis Dr. med. M. Hedayatian und Maria Engelbrecht:
– Gemeinschaftspraxis Dr. med. M. Hedayatian und Maria Engelbrecht...
  Vaccine Pfizer...
An unexpected exception of type UnboundLocalError occurred. Arguments:
("local variable 'slot_date_second' referenced before assignment",)

The assignment went wrong here:

if isinstance(slot, dict) and 'start_date' in slot:
slot_date_first = slot['start_date']
if vac_name != "janssen":
slot_date_second = slot['steps'][1]['start_date']
elif isinstance(slot, str) and vac_name == 'janssen':
slot_date_first = slot # should be for Janssen only, otherwise it is a list
elif isinstance(slot, list):
slot_date_first = slot[0]
if vac_name != "janssen": # maybe redundant?
slot_date_second = slot[1]
else:
log('error while fetching first slot.', color='red')
return False

The actual result was of type str ("2021-06-22T15:40:00.000+02:00"). It works fine for other runs...
So there are multi-shot vaccinations where the results actually are of type str. This is where it happened: https://www.doctolib.de/gemeinschaftspraxis/neuss/gemeinschaftspraxis-dr-med-m-hedayatian-und-maria-engelbrecht

I guess the doctor didn't configure Doctolib correctly, still the script should not crash on this.

[BUG] Too strong city name filtering

In cities like Hamburg in Germany, the neighborhoods are considered as city by doctolib (e.g. Hamburg-Rotherbaum)
All of these are still in Hamburg but the script skips these e.g.

2021-06-26 12:56:50,361:DEBUG:root::doctoshotgun.py:601:main Skipping city 'Hamburg-Rotherbaum' Schmerztherapie am Rothenbaum

Could the constraints be relaxed?

Trying to use the same program in Germany, and I got a few questions

So I dont really know how to get the motive, I thing you got it from the url like this: ref_visit_motive_ids[]=7109
with 7109 being the motive for the biontech vaccine.
So I tried it and I always get the follwing error:
Unable to find mRNA motive
Motives: Zweitimpfung Covid-19 (BioNTech-Pfizer), Erstimpfung Covid-19 (BioNTech-Pfizer), Erstimpfung Covid-19 (AstraZeneca), Zweitimpfung Covid-19 (AstraZeneca)
Zweitimpfung meaning secondshot and Erstimpfung meaning firstshot.

I would be very glad if anyone could help me!

Merci in advance :)

410 ClientError : Gone

Hi,

Whenever I look for an available slot, I always got the same error with Center Pharmacie de la Mairie (Paris).

Center Pharmacie de la Mairie (Paris):
An unexpected exception of type ClientError occurred. Arguments:
('410 Client Error: Gone',)

After looking for this specific center in Doctolib, I got a 410. This might be the reason why Doctoshotgun can't retrieve the available slots.

Configuration :

  • Python : 3.9.5
  • OS : Windows 10

Many thanks,

520 Server Error

I often get the following error message, sometimes after a few minutes, other times after hours. Afterwards the script aborts.
What does the error message mean? Connection problems are detected properly.

An unexpected exception of type ServerError occured. Arguments: ('520 Server Error:',)

Maybe the response is just truncated?

2021-06-24_18h10_52

[FEATURE] Exclude entries by words

Whenever I search (Germany) a list of doctors will be returned, however, there are also pediatrists included in the list which will probably NOT accept me as a patient.
However, I cannot exclude them unless I manually modify the script to exclude such entries - a feature would be perfect.

Example:
"Facharztpraxis für Kinder und Jugendliche" - by just excluding entries with "Kinder" in the name it would work, this should work almost every time.

Error 404 for getting list of centers

Hi,

first of all, great work! Thanks a lot!!!

Anyhow, I get an error for running my script on Mac 11.4, Python 3.9.5, pip 21.1.2 for the city of Berlin:

./doctoshotgun.py berlin [email protected]
Password:
Starting to look for vaccine slots for real_name in 7 next day(s)...
Vaccines: Pfizer, Moderna
This may take a few minutes/hours, be patient!
Traceback (most recent call last):
  File "/Users/user/Documents/git/doctoshotgun/./doctoshotgun.py", line 489, in <module>
    sys.exit(Application().main())
  File "/Users/user/Documents/git/doctoshotgun/./doctoshotgun.py", line 462, in main
    for center in docto.find_centers(cities, motives):
  File "/Users/user/Documents/git/doctoshotgun/./doctoshotgun.py", line 203, in find_centers
    self.centers.go(where=city, params={'ref_visit_motive_ids[]': motives})
  File "/usr/local/lib/python3.9/site-packages/woob/browser/url.py", line 98, in go
    r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 911, in location
    response = self.open(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 898, in open
    return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 790, in open
    return super(DomainBrowser, self).open(req, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 531, in open
    response = self.session.send(preq,
  File "/Users/user/Documents/git/doctoshotgun/./doctoshotgun.py", line 57, in send
    return callback(self, resp)
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 527, in inner_callback
    self.raise_for_status(response)
  File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 559, in raise_for_status
    raise HTTPNotFound(http_error_msg, response=response)
woob.browser.exceptions.HTTPNotFound: 404 Client Error: Not Found

Seems to me that the "find_centers" returns something unexpected. The displayed name at the beginning is correct, hence the login seems to be working.

Interestingly, the same script/login works for the city of Paris for me:

./doctoshotgun.py paris [email protected]
Password:
Starting to look for vaccine slots for real_name in 7 next day(s)...
Vaccines: Pfizer, Moderna
This may take a few minutes/hours, be patient!

Center SOS Médecins Grand Paris:
– SOS Médecins - Consultations Paris 13... no availabilities
– SOS Médecins - Consultations Paris 19... no availabilities
– SOS Médecins - Consultations Paris 17e... no availabilities
– Centre vaccinations COVID SOS Médecins Paris-17 ... found!
  ├╴ Best slot found: Fri Jun  5 13:45:00 2021
  ├╴ Second shot: Fri Jul 17 13:45:00 2021
  ├╴ Booking for real_name...
  └╴ Booking status: True

💉 Booked! Congratulations.

Suggestion : Prise de rendez-vous pour une deuxième dose ou une troisième dose uniquement

Aujourd'hui le script ne permet que de réserver les deux rendez-vous (première et deuxième dose) d'un coup lorsque l'on le lance.

Serait-ce pertinent d'ajouter l'option permettant de prendre rendez vous uniquement pour la deuxième ou la troisième dose ?

Il me semble que les IDs sont les suivants :

  • Deuxième dose Pfizer : 6971
  • Deuxième dose Moderna : 7004
  • Troisième dose Pfizer : 8192
  • Troisième dose Moderna : 8193

En tout cas merci pour ce que vous faites, ça a permis à moi et mes proches (une dizaine de personnes) de se faire vacciner rapidement !

When I try to book in Berlin, I always get false or ('422 Client Error: Unprocessable Entity',) when a slot is found

Hi and thanks for this nice program,

when I try to get a third shot appointment in "Corona Impfzentren - Berlin" I always get false, unavailable slot or ('422 Client Error: Unprocessable Entity',) as result, when a slot is found.

Center Corona Impfzentren - Berlin (Berlin):
– Messe Berlin/ Halle 21...
  Vaccine Auffrischung.*Pfizer|Pfizer.*Auffrischung|Dritt.*Pfizer|Booster.*Pfizer... found!
  ├╴ Best slot found: Sun Jan  2 13:45:00 2022
An unexpected exception of type ClientError occurred. Arguments:
('422 Client Error: Unprocessable Entity',)
Center Corona Impfzentren - Berlin (Berlin):
– Messe Berlin/ Halle 21...
  Vaccine Auffrischung.*Pfizer|Pfizer.*Auffrischung|Dritt.*Pfizer|Booster.*Pfizer... found!
  ├╴ Best slot found: Fri Dec 31 13:00:00 2021
  ├╴ Booking for ...
  └╴ Booking status: False
– Flughafen Berlin-Tegel / Terminal C...
  Vaccine Auffrischung.*Pfizer|Pfizer.*Auffrischung|Dritt.*Pfizer|Booster.*Pfizer... found!
  ├╴ Best slot found: Sun Dec 19 09:00:00 2021
  └╴ Appointment not available anymore :( unavailable_slot

the command I use:

./doctoshotgun.py -3 --start-date 08/12/2021 --end-date 14/12/2022 --center "Corona Impfzentren - Berlin" de Berlin ...

Error 401 with latest version

Hello,

I cloned the repository right now, and got a 401 error when running the script :

jbchauvin@MacBook-Pro ~/P/t/doctoshotgun> ./doctoshotgun.py Paris [email protected]
Password:

Traceback (most recent call last):
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 506, in
sys.exit(Application().main())
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 437, in main
patients = docto.get_patients()
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 227, in get_patients
self.master_patient.go()
File "/usr/local/lib/python3.9/site-packages/woob/browser/url.py", line 98, in go
r = self.browser.location(self.build(**kwargs), params=params, data=data, json=json, method=method, headers=headers or {})
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 911, in location
response = self.open(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 898, in open
return super(PagesBrowser, self).open(callback=internal_callback, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 790, in open
return super(DomainBrowser, self).open(req, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 531, in open
response = self.session.send(preq,
File "/Users/jbchauvin/Projets/tmp/doctoshotgun/./doctoshotgun.py", line 57, in send
return callback(self, resp)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 527, in inner_callback
self.raise_for_status(response)
File "/usr/local/lib/python3.9/site-packages/woob/browser/browsers.py", line 560, in raise_for_status
raise ClientError(http_error_msg, response=response)
woob.browser.exceptions.ClientError: 401 Client Error: Unauthorized

Explications potentielles pour "found" puis "Appointment not available anymore"

Bonjour,

(je m'exprime en Francais car j'ai vu les autres issues ecrites comme ca mais si l'anglais est mieux je peus switcher).
Merci pour ce script qui je l'espere me sera tres utile.
Je suis en train de le faire tourner et je voudrais savoir quelles sont les explications possibles a la situation ou un slot est indique comme "found" puis est finalement indique comme "Appointment not available anymore".

Exemple:

– Centre de Vaccination - Mairie du 13e... found!
  ├╴ Best slot found: Wed May 26 12:00:00 2021
  └╴ Appointment not available anymore :( unavailable_slot
– Centre de vaccination éphémère du 19 (curial)... found!
  ├╴ Best slot found: Wed May 26 12:00:00 2021
  ├╴ Second shot: Mon Jul  5 18:20:00 2021
  └╴ Appointment not available anymore :( unavailable_slot
– Centre de vaccination éphémère du 20 (Mouraud)... found!
  ├╴ Best slot found: Wed May 26 11:30:00 2021
  ├╴ Second shot: Mon Jul  5 18:20:00 2021
  └╴ Appointment not available anymore :( unavailable_slot
– Centre de vaccination éphémère du 18 (Binet)... found!
  ├╴ Best slot found: Wed May 26 12:00:00 2021
  ├╴ Second shot: Mon Jul  5 18:20:00 2021
  └╴ Appointment not available anymore :( unavailable_slot
– Centre de vaccination éphémère du 11 (Houdin)... found!
  ├╴ Best slot found: Wed May 26 12:00:00 2021
  ├╴ Second shot: Mon Jul  5 18:20:00 2021
  └╴ Appointment not available anymore :( unavailable_slot
– Centre de vaccination éphémère du 10 (Boy-Zelensky)... found!
  ├╴ Best slot found: Wed May 26 12:00:00 2021
  └╴ Appointment not available anymore :( unavailable_slot

Je me dis qu'il est possible d'y avoir plusieurs scripts en concurrence mais de la a ce que la situation se reproduise autant je trouve ca etrange.
Cela dit si c'est le cas, il y a peut-etre moyen d'avoir un compteur aggrege du nombre de scripts tournant en concurrence pour une certaine ville.

CloudFlare blocking request macOS 10.13.3

Hi,

Thank you for the very nice script!
This issue is not specific to doctoshotgun but maybe you can help, when running the code I get this error :

Request blocked by CloudFlare

I understand that cloudscraper should bypass this anti-bot security but it is not the case.
Do you have any pointers/ideas on how to solve my issue ?

Thanks!

Python 3.9.5
macOS 10.13.3 (High Sierra)

('525 Server Error: ',)

Since yesterday, I get the following error after a few minutes:

An unexpected exception of type ServerError occurred. Arguments:
('525 Server Error: ',)
root@doctolib:/doctolib#

Do u have any ideas regarding this issue?

Best
Tn

Using the script for doctolib.de (Berlin) - already solved

Hello,

I cant seem to get this to work for doctolib.de. It should not be so difficult. I have the following set of praxises and parameters:

DOCTOLIB_BASE_API_URL = "https://www.doctolib.de/availabilities.json"

PRACTICE_PARAMS = {
    "biontech_arena": "visit_motive_ids=2495719&agenda_ids=397766-397800-402408-397776&practice_ids=158431",
    "biontech_messe": "visit_motive_ids=2495719&agenda_ids=397844-397846-457504-397845-457511-457405-457406-457411-457415-457416-457418-457426-457436-457439-457443-457453-457477-457487-457497-404659-457400-457404-457407-457408-457409-457410-457412-457414-457419-457420-457421-457424-457425-457427-457428-457429-457430-457432-457435-457442-457448-457457-457463-457470-457483-457489-457493&practice_ids=158434",
    "biontech_tegel": "visit_motive_ids=2495719&agenda_ids=397843-457297-397841-397842-457512-457515-457460-457514-457363-457500-404656-457510-457513-457268-457285-457293-457324-457341-457250-457251-457252-457253-457254-457255-457256-457263-457264-457265-457266-457267-457271-457275-457276-457277-457279-457281-457282-457286-457287-457289-457290-457292-457294-457295-457300-457301-457303-457309-457317-457323-457326-457331-457333-457338-457343-457349-457358-457399-457413&practice_ids=158436",
    "biontech_velodrom": "visit_motive_ids=2495719&agenda_ids=457319-404654-457312-457215-397973-457206-457227-457204-457208-457229-457280-457296-397974-397972-457310-457210-457212-457213-457216-457218-457274-457278-457283-457288-457291-457299-457304-457306-457315-457321&practice_ids=158435",
    "erikahess_moderna": "visit_motive_ids=2537716&agenda_ids=457956-457952-457975-457943-457979-457947-457951-457954-457902-457959-457903-457976-457966-457901-457913-457970-457941-457945-457946-457955-457953-457968-457971-457920-457973-457977-457960-457961-457963-457964-457906-457936-457967-457944-457910&practice_ids=158437",
    "tegel_moderna": "visit_motive_ids=2537716&agenda_ids=465584-465619-465575-465527-465534-465598-465601-465651-465543-466146-465630-465532-465526-465609-465615-465653-466127-466144-466128-466129-466130-466131-466132-466133-466134-466135-466136-466137-466138-466139-466140-466141-466143-466145-466147-466148-466149-466150-466151-466152-466153-466154-465678-465550-465553-465594-465701-465555-465558-465580-465582-465592&practice_ids=158436",
    "tempelhof_moderna": "visit_motive_ids=2537716&agenda_ids=467901-467933-467894-467897-467898-467899-467895-467896-467900-467908-467912-467893-467903-467905-467906-467907-467910-467911-467934-467935-467936-467937-467938-467939-467940&practice_ids=158433",
}

# https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-XXXXX
PRACTICE_MAPPING = {
    "biontech_arena": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158431",
    "biontech_messe": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158434",
    "biontech_tegel": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158436",
    "biontech_velodrom": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158435",
    "erikahess_moderna": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158437",
    "tegel_moderna": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158436",
    "tempelhof_moderna": "https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=practice-158433",
}

What would I have to change? In the script?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.