poll_dweets_forever() is a long-running function that periodically calls on line (11) the get_lastest_dweet() method we just covered. When a dweet is available, it is handled on line (12) by process_dweet(), which we will discuss shortly:
def poll_dweets_forever(delay_secs=2):
"""Poll dweet.io for dweets about our thing."""
while True:
dweet = get_last_dweet() # (11)
if dweet is not None:
process_dweet(dweet) # (12)
sleep(delay_secs) # (13)
We sleep for a default delay of 2 seconds on line (13) before continuing the loop. Practically, this means there will be up to an approximate 2-second delay between using one of the dweeting URLs to request a LED state change and the LED altering its state.
At this point in the master source file, you will come across a function named stream_dweets_forever...