get_block
Function
def get_block(number, full_transactions=False, attempts=18):
if type(number) is str and number not in ('latest',) and type(number) is not int:
raise ValueError("Invalid block number")
while attempts > 0:
try:
return web3.eth.get_block(number, full_transactions=full_transactions)
except Exception as e:
logging.debug(e)
time.sleep(1)
attempts -= 1
return None
Description
Check if the request block is a string “latest” or a number
Loop while there are attempts remaining
Get the block with/without full transactions
Return the block or null