Open Olascoaga opened 7 years ago
Something like this
def reconnect(self):
if(self.websocket):
self.websocket.close()
self.websocket_client.wss = None
self.set_session_cookies()
self.websocket_client = WebsocketClient(self)
websocket_thread = threading.Thread(target=self.websocket.run_forever)
websocket_thread.daemon = True
websocket_thread.start()
time.sleep(5)
self.ssid(self.sid)
thanks a lot
I added the previous lines to
api.py.
If I use
api.reconnect()
I get the error:
AttributeError: 'IQOptionApi' object has no attribute 'sid'
I replaced it with ssid and get another error. Can someone help please how do use the reconnection correctly?
I was trying to use the api and really i getting it, it works greatly but i have only one trouble, after some time of use
api.getcandles
orapi.profile.balance
orapi.buy
it is produced an exception in websocketthis is the exception:
I was trying to handle it with try-except and recovery the connection but i can't if i try to use the api.connect method after the exception looks like it is connected but if i use any function return the same exception, so how to reconnect the api after an exception like this