From 98566a2d06519e40713e327e50ee02b9a6880351 Mon Sep 17 00:00:00 2001 From: gregory Date: Tue, 2 Sep 2025 19:34:11 -0400 Subject: [PATCH] add limit to number of commets script can make in one pass --- make_reservations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make_reservations.py b/make_reservations.py index a673fa3..04aa16a 100644 --- a/make_reservations.py +++ b/make_reservations.py @@ -21,7 +21,8 @@ DEFAULT_CONFIG_PATH = './config.ini' DEFAULT_WORKING_DIRECTORY = './tmp' DEFAULT_APP_URL = 'https://app.flightschedulepro.com' DEFAULT_TIMEOUT = 10 # seconds -DEFAULT_DAY_LOOKAHEAD = 2 +DEFAULT_DAY_LOOKAHEAD = 2 +DEFAULT_MAX_COMMENTS = 5 parser = argparse.ArgumentParser( @@ -154,6 +155,8 @@ def filter_row_by_date(reservation_row: webelement.WebElement) -> bool: rows = get_reservation_rows() row_count = len(rows) +if row_count > DEFAULT_MAX_COMMENTS: + die('Found more than ' + str(DEFAULT_MAX_COMMENTS) + ' reservations. Aborting...') print('found ' + str(row_count) + ' reservations to add reservation comment to') for i in range(0, row_count): row = rows[i]