无法通过客户端Python

时间:2018-10-29 06:32:16

标签: python python-3.x websocket client

我正在尝试使用python代码与websocket客户端连接:

>>> from websocket import create_connection
>>> ws = create_connection("wss://iqoption.com/echo/websocket")
>>> ws
<websocket._core.WebSocket object at 0x000001DAFD2D5438>

>>> ws.send("Hello, World")
    18
>>> ws.recv()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python35\lib\site-packages\websocket\_core.py", line 300, in recv
    opcode, data = self.recv_data()
  File "C:\Python35\lib\site-packages\websocket\_core.py", line 317, in recv_data
    opcode, frame = self.recv_data_frame(control_frame)
  File "C:\Python35\lib\site-packages\websocket\_core.py", line 330, in recv_data_frame
    frame = self.recv_frame()
  File "C:\Python35\lib\site-packages\websocket\_core.py", line 364, in recv_frame
    return self.frame_buffer.recv_frame()
  File "C:\Python35\lib\site-packages\websocket\_abnf.py", line 361, in recv_frame
    self.recv_header()
  File "C:\Python35\lib\site-packages\websocket\_abnf.py", line 309, in recv_header
    header = self.recv_strict(2)
  File "C:\Python35\lib\site-packages\websocket\_abnf.py", line 396, in recv_strict
    bytes_ = self.recv(min(16384, shortage))
  File "C:\Python35\lib\site-packages\websocket\_core.py", line 434, in _recv
    return recv(self.sock, bufsize)
  File "C:\Python35\lib\site-packages\websocket\_socket.py", line 81, in recv
    bytes_ = sock.recv(bufsize)
  File "C:\Python35\lib\ssl.py", line 909, in recv
    return self.read(buflen)
  File "C:\Python35\lib\ssl.py", line 786, in read
    return self._sslobj.read(len, buffer)
  File "C:\Python35\lib\ssl.py", line 572, in read
    v = self._sslobj.read(len or 1024)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

请参见下图:
enter image description here

我稍后尝试将其与MT5连接。但无法访问报价。请让我知道如何访问网络套接字。

0 个答案:

没有答案