rbignon / doctoshotgun

Script to automatically book a vaccine slot on Doctolib in the next seven days.
GNU General Public License v3.0
549 stars 142 forks source link

I keep getting an exception of type KeyError #312

Open Tylones opened 2 years ago

Tylones commented 2 years ago

Hello,

I am trying to book a slot for a second dose only and I keep getting the same error. Here's the stack :

found!
  ├╴ Best slot found: Fri Jan  7 14:25:00 2022
2022-01-06 17:41:20,002:DEBUG:urllib3.connectionpool::connectionpool.py:452:_make_request https://www.doctolib.fr:443 "POST /appointments.json HTTP/1.1" 200 None
2022-01-06 17:41:20,024:INFO:browser::browsers.py:369:save_response Response saved to 04a310d87fe04418a83bdce601761df3
2022-01-06 17:41:20,024:DEBUG:browser::browsers.py:880:internal_callback Handle https://www.doctolib.fr/appointments.json with AppointmentPage
2022-01-06 17:41:20,209:DEBUG:urllib3.connectionpool::connectionpool.py:452:_make_request https://www.doctolib.fr:443 "GET /appointments/3205542638-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMzIwNTU0MjYzOD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--2837adf8a7ae436192be6729ced96560a44c206c/edit.json HTTP/1.1" 200 None
2022-01-06 17:41:20,224:INFO:browser::browsers.py:369:save_response Response saved to f7cc04934ccc4a96be6425cb5b9a7b5f
2022-01-06 17:41:20,240:DEBUG:browser::browsers.py:880:internal_callback Handle https://www.doctolib.fr/appointments/3205542638-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMzIwNTU0MjYzOD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--2837adf8a7ae436192be6729ced96560a44c206c/edit.json with AppointmentEditPage
  ├╴ Booking for NAME_REDACTED...
2022-01-06 17:41:20,425:DEBUG:urllib3.connectionpool::connectionpool.py:452:_make_request https://www.doctolib.fr:443 "GET /appointments/3205542638-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMzIwNTU0MjYzOD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--2837adf8a7ae436192be6729ced96560a44c206c/edit.json?master_patient_id=86177620 HTTP/1.1" 200 None
2022-01-06 17:41:20,441:INFO:browser::browsers.py:369:save_response Response saved to 8b5a663a48cc4a0eab4e77dc319a2ee2
2022-01-06 17:41:20,456:DEBUG:browser::browsers.py:880:internal_callback Handle https://www.doctolib.fr/appointments/3205542638-BAh7CEkiCGdpZAY6BkVUSSI1Z2lkOi8vZG9jdG9saWIvQXBwb2ludG1lbnQvMzIwNTU0MjYzOD9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIMZGVmYXVsdAY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--2837adf8a7ae436192be6729ced96560a44c206c/edit.json?master_patient_id=86177620 with AppointmentEditPage
An unexpected exception of type KeyError occurred. Arguments:
('appointment',)
Traceback (most recent call last):
  File "C:\Users\etien\Documents\doctoshotgun\doctoshotgun.py", line 912, in main
    if docto.try_to_book(center, vaccine_list, start_date, end_date, excluded_weekdays, args.only_second, args.only_third, args.dry_run, args.confirm):
  File "C:\Users\etien\Documents\doctoshotgun\doctoshotgun.py", line 410, in try_to_book
    if self.try_to_book_place(profile_id, motive_id, practice_id, agenda_ids, vac_name.lower(), start_date, end_date, excluded_weekdays, only_second, only_third, dry_run, confirm):
  File "C:\Users\etien\Documents\doctoshotgun\doctoshotgun.py", line 536, in try_to_book_place
    for field in self.page.get_custom_fields():
  File "C:\Users\etien\Documents\doctoshotgun\doctoshotgun.py", line 210, in get_custom_fields
    for field in self.doc['appointment']['custom_fields']:
KeyError: 'appointment'

Do you have any idea of where it can come from ?

Thanks in advance