Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for explicit proxy configuration #1

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2bcfafb
notification sound when appointment found
nicolaus-hee May 25, 2021
56b50dc
make playsound an optional dependence
rbignon May 27, 2021
dde5956
do not crash if playsound() can't play sound
rbignon May 27, 2021
bb4bb15
catch another kind of error
rbignon May 27, 2021
a3b5946
add Dockerfile and docker usage instructions
cterence May 26, 2021
476bf2f
lighter Docker image
cterence May 27, 2021
c72fb0d
Pfizer filter (#48)
cvermot May 29, 2021
3f8bc96
add -m option to filter also on Moderna
rbignon May 29, 2021
e6e19bc
Looking for next step : ability for anybody to book anytime : Checkin…
cvermot May 29, 2021
90121a7
set default --time-window value to 7
rbignon May 29, 2021
5175ae0
fix coding style
rbignon May 29, 2021
8c399c8
display an error message if the city is not found
rbignon May 29, 2021
22e4f8b
change name in example
cvermot May 29, 2021
901d9c4
change description
rbignon May 30, 2021
e64a7bf
README: add short option names
rbignon May 31, 2021
9f29222
Enable to select a specific date for first shot
RaphaelMeudec Jun 1, 2021
cbb99c3
Add in readme
RaphaelMeudec Jun 1, 2021
4fe4be5
From --date to --start-date
RaphaelMeudec Jun 1, 2021
bd9b409
--start-date in readme
RaphaelMeudec Jun 1, 2021
d771483
Add log on start date
RaphaelMeudec Jun 1, 2021
c79b7cd
add --dry-run to not really book a slot
rbignon Jun 2, 2021
367ee9a
remove dependence to playsound (as it may not work)
rbignon Jun 6, 2021
b15ad96
Implement 2-factor authentication during login (by email)
aduffeck Jun 9, 2021
ce0be03
Adding country support. Now France (fr) and Germany are available (de)
edwillys Jun 6, 2021
e478c42
Better handling of country argument
edwillys Jun 6, 2021
efc99ca
city, username and password are now positional arguments again
edwillys Jun 7, 2021
13426cc
Not looking anymore for Janssen's 2nd shot, as there isn't any
edwillys Jun 7, 2021
b7be121
Removing playsound dependencies as they are now optional on the main …
edwillys Jun 7, 2021
6a9b522
Making terminal colors work for windows
edwillys Jun 9, 2021
ac0ccca
rename _KEY_* attributes to KEY_*
rbignon Jun 10, 2021
af67011
fix: use BASEURL during login to work with doctolib.de
rbignon Jun 11, 2021
5936311
remove useless 'logged' property
rbignon Jun 11, 2021
580b805
fix usage of --start-date, and add --end-date option
rbignon Jun 11, 2021
9a44775
do not display place name if empty
rbignon Jun 11, 2021
7451871
introduce --end-date in README.md
rbignon Jun 11, 2021
1349979
update example with new country parameter
rbignon Jun 11, 2021
cb6b941
README.md: reintroduce example.svg
rbignon Jun 11, 2021
a518ee5
do not crash when receiving only one date for other vaccines than jan…
rbignon Jun 12, 2021
60b023e
Do not book slots if new patients are not allowed
gitolicious Jun 11, 2021
10cfc0e
change error message when no vaccine motives are found
rbignon Jun 12, 2021
605af57
Adjust readme to run docker interactively
aduffeck Jun 18, 2021
11a9654
add Cloudflare-specific error message on login request
gitolicious Jun 17, 2021
44af15d
Enhanced Cloudflare log message
gitolicious Jun 23, 2021
7813cc1
merged many open PRs into one
gitolicious Jul 1, 2021
477c90b
update README with new arguments
rbignon Jul 5, 2021
099f5d2
Add support for paged results on centers page
danburg Jul 6, 2021
ded2df3
Fix tests
danburg Jul 6, 2021
7bd2004
Add paging support for french doctolib + add tests
danburg Jul 7, 2021
2d95176
third shot for germany
r00tk1d Nov 19, 2021
208de4b
added german third shot keys
r00tk1d Nov 20, 2021
ab31a64
tests: fix search URLs responses for DE third shots
clemux Nov 21, 2021
0eeb972
handle queuing system from Doctolib
rbignon Nov 29, 2021
6ccb9b1
store browser's state (prevent 2FA when the script relaunch)
rbignon Nov 29, 2021
18f2327
display choices when user is prompted
rbignon Nov 29, 2021
4150402
tests: mock out state mixin methods
clemux Nov 29, 2021
7326468
catch 410 error which occurs sometimes on centers
rbignon Nov 30, 2021
3c1b700
fix returned values in the mocked browser
rbignon Nov 30, 2021
b22c6cf
Adding support for proxy configuration
seranpion Dec 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
__pycache__
*.pyc

.vscode
.devcontainer
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Base image
FROM python:3.9.5-slim as base

# Build stage
FROM base as builder

# Dependency install directory
RUN mkdir /install
WORKDIR /install

# Install dependencies
COPY ./requirements.txt .
RUN pip install --prefix /install -r requirements.txt

# Run stage
FROM base

WORKDIR /usr/src/app

# Fetch dependencies from the build stage
COPY --from=builder /install /usr/local

COPY ./doctoshotgun.py .

# Entrypoint - Run the main script
ENTRYPOINT ["./doctoshotgun.py"]
104 changes: 90 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# DOCTOSHOTGUN

This script lets you automatically book a vaccine slot on Doctolib for today or
tomorrow, following rules from the French Government.

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

<p align="center">
<img src="https://raw.githubusercontent.com/rbignon/doctoshotgun/da5f65a1e2ecc7b543376b1549c62004a454b90d/example.svg">
<img src="https://github.com/rbignon/doctoshotgun/raw/master/example.svg">
</p>

## Python dependencies
Expand All @@ -14,9 +13,13 @@ tomorrow, following rules from the French Government.
- 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](https://www.python.org/).

Install dependencies:

```
Expand All @@ -26,31 +29,70 @@ pip install -r requirements.txt
Run:

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

Optional arguments:
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
--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)
--dry-run do not really book the slot
--code CODE 2FA code
--proxy PROXY, -P PROXY
configure a network proxy to use
```

### With Docker

Build the image:

```
--center "<center_name>" [--center "<other_center>" …] : filter centers to only choose one from the provided list
--patient <index> : select patient for which book a slot
--debug : display debug information
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 <city1>,<city2>,<city3> <email> [password]
$ ./doctoshotgun.py <country{fr,de}> <city1>,<city2>,<city3> <email> [<password>]
```

### Filter on centers

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

```
$ ./doctoshotgun.py paris [email protected] \
$ ./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"
```
Expand All @@ -60,7 +102,7 @@ $ ./doctoshotgun.py paris [email protected] \
For doctolib accounts with more thant one patient, you can select patient just after launching the script:

```
$ ./doctoshotgun.py paris [email protected] PASSWORD
$ ./doctoshotgun.py fr paris [email protected] PASSWORD
Available patients are:
* [0] Roger Philibert
* [1] Luce Philibert
Expand All @@ -70,10 +112,44 @@ For which patient do you want to book a slot?
You can also give the patient id as argument:

```
$ ./doctoshotgun.py paris [email protected] PASSWORD -p 1
$ ./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

Expand Down
Binary file added ding.mp3
Binary file not shown.
Loading