I wish to make a simple application using KivyMD. I want to display the latest block and pending txns on the ethereum blockchain and have it update automatically with every new block. I'm using infura url and web3.py.
pending_block = web3.eth.getBlock(block_identifier='pending', full_transactions=True)
pending_transactions = pending_block['transactions']
What do I do to make the app automatically get this every time a new block originates? Listeners? Websockets? Or use a while loop that sleeps for a specified time and calls a function to fetch the latest data?