Make the interval in he script configureable

This commit is contained in:
Jan Losinski 2019-01-06 03:18:46 +01:00
parent 80e3452be7
commit 26037bda55
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ parser = argparse.ArgumentParser(description="Try to book an appointment at berl
parser.add_argument("--name", required=True, help="The name of the applicant") parser.add_argument("--name", required=True, help="The name of the applicant")
parser.add_argument("--email", required=True, help="The email of the applicant") parser.add_argument("--email", required=True, help="The email of the applicant")
parser.add_argument("--url", default=START_URL, help="The start orl of the booking process") parser.add_argument("--url", default=START_URL, help="The start orl of the booking process")
parser.add_argument("--interval", default=30, type=int, help="The interval the booking is tried")
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig( logging.basicConfig(
@ -35,7 +36,7 @@ if __name__ == "__main__":
svc = BookingService(url, debug=False) svc = BookingService(url, debug=False)
if svc.book(name=args.name, email=args.email): if svc.book(name=args.name, email=args.email):
break break
time.sleep(30) time.sleep(max(30, args.interval))
except KeyboardInterrupt: except KeyboardInterrupt:
logger.info("Got keyboard interrupt - stopping.") logger.info("Got keyboard interrupt - stopping.")
break break