Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

client_tests don't work #159

Open
JannisJoplin opened this issue Sep 15, 2018 · 8 comments
Open

client_tests don't work #159

JannisJoplin opened this issue Sep 15, 2018 · 8 comments

Comments

@JannisJoplin
Copy link

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

@jemeraldo
Copy link

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.

@JannisJoplin
Copy link
Author

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

@deepbrook
Copy link
Collaborator

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.

@JannisJoplin
Copy link
Author

Hi Nils,

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

Grüße Jannis

@ReyvanZA
Copy link

ReyvanZA commented Oct 12, 2018

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)

@kilometer2162
Copy link

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!

@JannisJoplin
Copy link
Author

Hi Nils,

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

Grüße

@JannisJoplin
Copy link
Author

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

@JannisJoplin JannisJoplin reopened this Feb 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants