Open francescor82 opened 9 months ago
I am seeing the same issue!
After updating to python-bitvavo-api 1.2.3 and websocket-client 1.7.0, I think I was able to solve the problem with this delta on bitvavo.py:
- def on_close(self, ws):
- self.receiveThread.exit()
+ def on_close(self, ws, close_status_code, close_msg):
That is:
exit()
.on_close
: in websockets 1.7.0, on_close
receives 3 params.What I see now is that, when the websocket is closed, the receiveThread
object will connect again, and subscribe again to all the previous subscriptions.
If someone wants to make a pull request with this change, it would be great!
I forgot one more line to add: closing the websocket in case of error.
def on_error(self, ws, error):
if 'error' in self.callbacks:
self.callbacks['error'](error)
else:
errorToConsole(error)
+ ws.close()
Hello, I'm using python-bitvavo-api 1.2.2 and websocket-client 0.57.0, I created an application starting from the example in the README, and occasionally I see the following error:
[websocket] error from callback <bound method Bitvavo.websocket.on_close of <python_bitvavo_api.bitvavo.Bitvavo.websocket object at 0x7f1dba1fa610>>: 'receiveThread' object has no attribute 'exit'
I had a quick look, in case it can help. The Bitvavo.websocket object has an object called
receiveThread
, of typereceiveThread
, inheriting fromthreading.Thread
. In tthis class I don't see anexit
method or attribute (bitvavo.py, lines 108-124). In a Python terminal, I instantiated an instance ofthreading.Thread
, and it also has noexit
attribute:I never used
threading
myself, but searching online it seems that the subclasses ofThread
must implement some explicit function if they want to be stopped from outside.