Jul-16-2024, 06:08 AM
Don't know what all the other stuff is or does just from a quick glance. Concerning the while loop: if your while loop doesn't stop then the condition:
As an example with random data:
has_more_data = Falseis not met. Quite why that is is not immediately apparent to me, but if you provide some sample data to work on, that may clarify itself.
As an example with random data:
from string import ascii_lowercase from random import choices, choice # reset to run again all_data = [] # reset to run again has_more_data = True # if 1 of these letters is chosen, adieu while loop! empty = choices(ascii_lowercase, k=3) # if has_more_data = False the while loop will exit, no need for break while has_more_data: print(f'empty = {empty}') # Fetch data data = choice(ascii_lowercase) if data in empty: # Debug: Print the response structure has_more_data = False print("Leaving the while loop ...") else: all_data.append(data) print(f'all_data = {all_data}')