I'm pulling data from my websocket server (Geth node) that returns an dictionary. I iterate over this dictionary in order to process data from it. My issue is the following:
First iteration would pull a dictionary containing
A B C D
Second iteration would pull a dictionary containing
E A C D B F
How would I implement my code in a way that streams data continuously, instead of having to receive new data along with already processed one? With the previous example, the second iteration of my code should return only E and F
Here's my code
def liquidCheck(self, address):
methodTarget = "0xf305d719"
while True:
tx_data = self.w3.geth.txpool.content()["pending"] #This function calls my WebSocket server and returns the dictionary
try:
for k, v in tx_data.items():
for k2, v2 in v.items():
methodId = v2.input[0:10]
if methodId.lower() != methodTarget.lower():
continue
else:
print("Target found, ciao")
return
except:
print(traceback.format_exc())