Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
API Loop Help
#2
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:

has_more_data = False
is 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}')
Reply


Messages In This Thread
API Loop Help - by tturner2304 - Jul-15-2024, 06:25 PM
RE: API Loop Help - by Pedroski55 - Jul-16-2024, 06:08 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020