+import json
+import os
+import sys
+
+def print_chronodose(basedir, dept):
+ print('------ %d' % (dept))
+ filename = os.path.join(basedir, '%d.json' % dept)
+ with open(filename) as f:
+ jdata = json.load(f)
+
+ for centre in jdata['centres_disponibles']:
+ appointment_schedules = centre.get('appointment_schedules')
+ if not appointment_schedules:
+ continue
+ for appointment_schedule in appointment_schedules:
+ name = appointment_schedule.get('name')
+ total = appointment_schedule.get('total')
+ if name == 'chronodose' and total != 0:
+ break
+ else:
+ continue
+
+ print(centre['nom'])
+ print(f' {total} creneau(x) chronodose')
+ print(f' {centre["url"]}')
+ print(' %s' % ', '.join(centre["vaccine_type"]))
+
+basedir = sys.argv[1]
+print_chronodose(basedir, 59)
+print_chronodose(basedir, 62)