Dec-20-2019, 04:00 PM
If you run it a third time, does it triple? What happens if you wait a couple minutes before running it again? The only way I see it doubling the number of instances rest on line 66. If there are multiple, identical Reservations; it would count duplicate instances. Trying printing the instance_list before the loop and run the script a couple of times.
On a side note, there are some code blocks here that can be simplified. In several places, the following pattern occurs:
On a side note, there are some code blocks here that can be simplified. In several places, the following pattern occurs:
if 'KeyName' in instance: key_name = instance['KeyName'] else: key_name = NoneThis effectively does the same thing as dict.get() with a default value included:
key_name = instance.get('KeyName', None)There are others too, but that one stood out the most.