From c50c31a6bd392bfe8c886834a4c0aac0b3284296 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 15 Oct 2018 04:37:43 -0400 Subject: [PATCH 1/2] =?UTF-8?q?[Mod]=20sendRequest=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E4=B8=BAsendPacket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 和onPacket对应。 --- tests/api/base/WebSocketClientTest.py | 2 +- vnpy/api/websocket/WebSocketClient.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api/base/WebSocketClientTest.py b/tests/api/base/WebSocketClientTest.py index 1bf1b923..dc9651dd 100644 --- a/tests/api/base/WebSocketClientTest.py +++ b/tests/api/base/WebSocketClientTest.py @@ -38,7 +38,7 @@ class WebsocketClientTest(unittest.TestCase): req = { 'name': 'val' } - self.c.sendRequest(req) + self.c.sendPacket(req) res = self.c.p.get(3) self.assertEqual(res, req) diff --git a/vnpy/api/websocket/WebSocketClient.py b/vnpy/api/websocket/WebSocketClient.py index 750a593f..9ae7cafb 100644 --- a/vnpy/api/websocket/WebSocketClient.py +++ b/vnpy/api/websocket/WebSocketClient.py @@ -55,7 +55,7 @@ class WebsocketClient(object): self._disconnect() #---------------------------------------------------------------------- - def sendRequest(self, dictObj): # type: (dict)->None + def sendPacket(self, dictObj): # type: (dict)->None """发出请求:相当于sendText(json.dumps(dictObj))""" return self._get_ws().send(json.dumps(dictObj), opcode=websocket.ABNF.OPCODE_TEXT) From 562fae9a2564cc4860608dffc7e14a9ca21778ca Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 15 Oct 2018 04:38:29 -0400 Subject: [PATCH 2/2] =?UTF-8?q?[Mod]=20WebSocketClient:=E9=9D=9E=E7=BA=AF?= =?UTF-8?q?=E8=99=9A=E5=87=BD=E6=95=B0=E4=B8=8D=E4=BD=BF=E7=94=A8abstractm?= =?UTF-8?q?ethod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/api/websocket/WebSocketClient.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vnpy/api/websocket/WebSocketClient.py b/vnpy/api/websocket/WebSocketClient.py index 9ae7cafb..3cde4ef7 100644 --- a/vnpy/api/websocket/WebSocketClient.py +++ b/vnpy/api/websocket/WebSocketClient.py @@ -154,7 +154,6 @@ class WebsocketClient(object): pass #---------------------------------------------------------------------- - @abstractmethod def onError(self, exceptionType, exceptionValue, tb): """Python错误回调""" - pass + return sys.excepthook(exceptionType, exceptionValue, tb)