Skip to content

Commit

Permalink
Add option to add specific center or doctor which
Browse files Browse the repository at this point in the history
  • Loading branch information
danburg committed Jun 20, 2021
1 parent 11a9654 commit af1be07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Further optional arguments:

```
--center "<name>" [--center <name> …] : filter centers to only choose one from the provided list
--additional-center "<name;city;link>" [--ac <name;city;link> …] : Add additional centers or doctors e.g. "Corona Impfzentren - Berlin;Berlin;/institut/berlin/ciz-berlin-berlin"
-p <index>, --patient <index> : select patient for which book a slot
-z, --pfizer : looking only for a Pfizer vaccine
-m, --moderna : looking only for a Moderna vaccine
Expand Down
15 changes: 13 additions & 2 deletions doctoshotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def do_login(self):

return True

def find_centers(self, where, motives=None):
def find_centers(self, where, motives=None, additional_centers=None):
if motives is None:
motives = self.vaccine_motives.keys()
for city in where:
Expand Down Expand Up @@ -256,6 +256,16 @@ def find_centers(self, where, motives=None):
except KeyError:
pass

if additional_centers:
for additional_center in additional_centers:
splitted = additional_center.split(';')
if len(splitted) == 3:
yield {
"name_with_title": splitted[0], #"Corona Impfzentren - Berlin",
"city": splitted[1], #"Berlin",
"url": splitted[2], #"/institut/berlin/ciz-berlin-berlin"
}

def get_patients(self):
self.master_patient.go()

Expand Down Expand Up @@ -511,6 +521,7 @@ def main(self):
parser.add_argument('--patient', '-p', type=int, default=-1, help='give patient ID')
parser.add_argument('--time-window', '-t', type=int, default=7, help='set how many next days the script look for slots (default = 7)')
parser.add_argument('--center', '-c', action='append', help='filter centers')
parser.add_argument('--additional-center', '-ac', action='append', help='Add additional centers or doctors: "name;city;link" e.g. "Corona Impfzentren - Berlin;Berlin;/institut/berlin/ciz-berlin-berlin"')
parser.add_argument('--start-date', type=str, default=None, help='first date on which you want to book the first slot (format should be DD/MM/YYYY)')
parser.add_argument('--end-date', type=str, default=None, help='last date on which you want to book the first slot (format should be DD/MM/YYYY)')
parser.add_argument('--dry-run', action='store_true', help='do not really book the slot')
Expand Down Expand Up @@ -591,7 +602,7 @@ def main(self):

while True:
try:
for center in docto.find_centers(cities, motives):
for center in docto.find_centers(cities, motives, args.additional_center):
if args.center:
if center['name_with_title'] not in args.center:
logging.debug("Skipping center '%s'", center['name_with_title'])
Expand Down

0 comments on commit af1be07

Please sign in to comment.