btfxwss icon indicating copy to clipboard operation
btfxwss copied to clipboard

client_tests don't work

Open JannisJoplin opened this issue 7 years ago • 8 comments

Hi, I have not much experience in python so excuse me if my question seems quite simple. Like in the instruction I installed via: pip install btfxwss

But then the client_tests didn´t work - neither the code written in usage. For the client_tests I get the error message attached.

test.log

Can anybody help me what I do wrong?

Thanks a lot Jannis

JannisJoplin avatar Sep 15 '18 15:09 JannisJoplin

Hi, I have not much experience in python so excuse me if my question seems quite simple. Like in the instruction I installed via: pip install btfxwss

But then the client_tests didn´t work - neither the code written in usage. For the client_tests I get the error message attached.

test.log

Can anybody help me what I do wrong?

Thanks a lot Jannis

Hi! I faced with same problem, and i solved it by next operations in file ...\Python36-32\lib\site-packages\btfxwss\connection.py:

def _on_message(self, ws, message): -> def _on_message(self, message): def _on_close(self, ws, *args): -> def _on_close(self, *args): def _on_open(self, ws): -> def _on_open(self): def _on_error(self, ws, error): -> def _on_error(self, error):

and now it works. I don't know exactly, but i guess it depends on new version of websocket module.

jemeraldo avatar Sep 26 '18 09:09 jemeraldo

Thank you - but does not help for me...

JannisJoplin avatar Sep 26 '18 11:09 JannisJoplin

Hey @JannisJoplin,

This was indeed an issue with the websocket library - the issue was fixed by them, and there should not be any need to fix callbacks arg anymore.

Please let me know if this issue is resolved for you now.

deepbrook avatar Sep 29 '18 18:09 deepbrook

Hi Nils,

sorry but it does not work for me. I have attached the test-protocol. test.log

Grüße Jannis

JannisJoplin avatar Oct 02 '18 20:10 JannisJoplin

test.log I have a similar issue. Hope this helps. My websocket client is up to date, and I've tested it separately and it works.

And this is the terminal output DEBUG:btfxwss.connection:run(): Starting up.. DEBUG:btfxwss.connection:_connect(): Initializing Connection.. DEBUG:btfxwss.connection:_connect(): Starting Connection.. --- request header --- DEBUG:websocket:--- request header --- GET /ws/2 HTTP/1.1 Upgrade: websocket Connection: Upgrade Host: api.bitfinex.com Origin: http://api.bitfinex.com Sec-WebSocket-Key: 8kpsPQpqsvLizJVjO7fSQQ== Sec-WebSocket-Version: 13

DEBUG:websocket:GET /ws/2 HTTP/1.1 Upgrade: websocket Connection: Upgrade Host: api.bitfinex.com Origin: http://api.bitfinex.com Sec-WebSocket-Key: 8kpsPQpqsvLizJVjO7fSQQ== Sec-WebSocket-Version: 13

DEBUG:websocket:----------------------- --- response header --- DEBUG:websocket:--- response header --- HTTP/1.1 101 Switching Protocols DEBUG:websocket:HTTP/1.1 101 Switching Protocols Date: Fri, 12 Oct 2018 10:13:21 GMT DEBUG:websocket:Date: Fri, 12 Oct 2018 10:13:21 GMT Connection: upgrade DEBUG:websocket:Connection: upgrade Set-Cookie: __cfduid=de2003168739480458321d375be7101e11539339200; expires=Sat, 12-Oct-19 10:13:20 GMT; path=/; domain=.bitfinex.com; HttpOnly DEBUG:websocket:Set-Cookie: __cfduid=de2003168739480458321d375be7101e11539339200; expires=Sat, 12-Oct-19 10:13:20 GMT; path=/; domain=.bitfinex.com; HttpOnly Upgrade: websocket DEBUG:websocket:Upgrade: websocket Sec-WebSocket-Accept: jY6XfLzPqlVkESQj6KhC1zAYS/A= DEBUG:websocket:Sec-WebSocket-Accept: jY6XfLzPqlVkESQj6KhC1zAYS/A= Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" DEBUG:websocket:Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Server: cloudflare DEBUG:websocket:Server: cloudflare CF-RAY: 4688cb143861b402-DUR DEBUG:websocket:CF-RAY: 4688cb143861b402-DUR

DEBUG:websocket:----------------------- error from callback <bound method WebSocketConnection._on_open of <WebSocketConnection(Thread-1, started daemon 11536)>>: _on_open() missing 1 required positional argument: 'ws' ERROR:websocket:error from callback <bound method WebSocketConnection._on_open of <WebSocketConnection(Thread-1, started daemon 11536)>>: _on_open() missing 1 required positional argument: 'ws' File "C:\Program Files (x86)\Python37-32\lib\site-packages\websocket_app.py", line 333, in _callback callback(*args) error from callback <bound method WebSocketConnection._on_message of <WebSocketConnection(Thread-1, started daemon 11536)>>: _on_message() missing 1 required positional argument: 'message' ERROR:websocket:error from callback <bound method WebSocketConnection._on_message of <WebSocketConnection(Thread-1, started daemon 11536)>>: _on_message() missing 1 required positional argument: 'message' File "C:\Program Files (x86)\Python37-32\lib\site-packages\websocket_app.py", line 333, in _callback callback(*args)

ReyvanZA avatar Oct 12 '18 10:10 ReyvanZA

I ran client_tests.py then I found errors below, I would appreciate if anyone who can help me to reslove these errors.

Ran 1 test in 11.056s

FAILED (failures=1)

Failure Traceback (most recent call last): File "/Volumes/Work/workspace/btfxwss-master/tests/client_tests.py", line 27, in test_subscribing_to_data_works wss.tickers('BTCUSD').get(block=False) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/queues.py", line 107, in get raise Empty _queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor yield File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 615, in run testMethod() File "/Volumes/Work/workspace/btfxwss-master/tests/client_tests.py", line 29, in test_subscribing_to_data_works self.fail("No ticker data arrived!") File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 680, in fail raise self.failureException(msg) AssertionError: No ticker data arrived!

kilometer2162 avatar Dec 05 '18 14:12 kilometer2162

Hi Nils,

sorry but it does not work for me. I have attached the test-protocol. test.log

Grüße

JannisJoplin avatar Feb 12 '19 15:02 JannisJoplin

Now it works, I am not sure what my mistake was... Thank You!

JannisJoplin avatar Feb 12 '19 15:02 JannisJoplin