I'm writing a python script using the blockchain API that takes as input a list of seed addresses, gets their transactions and the input/output addresses of each transaction. Then I get the transactions of the new addresses, their transactions and so on. Basically, the script unrolls the k-hop neighborhood of the seed addresses until there are no new neighbors left or a predefined k is met.
A lot of times I get the error "socket.timeout" when calling the
getaddr() function. I've tried the following:
while (True): try: data = getaddr() break except socket.timeout: print("Socket timeout. Retrying..") time.sleep(20) # Pause for 20 secs. Then retry.
But after a point I keep getting the same error so the loop never ends. Is there something I can do to fix it?