From 94c35cd593d54718ad5290f6a3fef23c7ca4d12c Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Sat, 10 Oct 2020 04:34:00 +0530 Subject: [PATCH] Get neturl to global namespace --- tracktokens-smartcontracts.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tracktokens-smartcontracts.py b/tracktokens-smartcontracts.py index bbdf50e..bb5dcfa 100755 --- a/tracktokens-smartcontracts.py +++ b/tracktokens-smartcontracts.py @@ -2332,7 +2332,7 @@ def switchNeturl(neturl): return testserverlist[neturlindex+1] -def reconnectSSE(neturl): +def reconnectSSE(websocketApi): # Switch a to different flosight # neturl = switchNeturl(neturl) # Connect to Flosight websocket to get data on new incoming blocks @@ -2342,18 +2342,18 @@ def reconnectSSE(neturl): scanBlockchain() logger.debug("Rescan completed") try: - logger.debug(f"Attempting websocket connection to {neturl}") - sio.connect(neturl + "socket.io/socket.io.js") + logger.debug(f"Attempting websocket connection to {websocketApi}") + sio.connect(websocketApi + "socket.io/socket.io.js") connection_status = True - return neturl + return websocketApi except: - logger.debug(f"Could not connect to the websocket endpoint {neturl}") - neturl = switchNeturl(neturl) + logger.debug(f"Could not connect to the websocket endpoint {websocketApi}") + websocketApi = switchNeturl(websocketApi) # At this point the script has updated to the latest block # Now we connect to flosight's websocket API to get information about the latest blocks -neturl = 'https://flosight.duckdns.org/' # Neturl is the URL for Flosight API whose websocket endpoint is being connected to +global neturl = 'https://flosight.duckdns.org/' # Neturl is the URL for Flosight API whose websocket endpoint is being connected to sio = socketio.Client(reconnection=False) # Connect to the websocket endpoint and return the new neturl