add try catch

This commit is contained in:
PascalR 2023-04-19 17:09:28 +02:00
parent 910231d4f4
commit 215b0ec1b7

View File

@ -26,6 +26,7 @@ private_key = PrivateKey(bytes.fromhex(env_private_key))
old_block_height = 0
while True:
try:
url = "https://blockchain.info/latestblock"
response = requests.get(url)
data = response.json()
@ -43,4 +44,6 @@ while True:
# relay_manager.close_connections() # NEEDED?!
old_block_height = block_height
time.sleep(5)
except Exception as e:
print(e)
exit(1)