From fc696ed71c81ad23dbb24335669e8fba2455baef Mon Sep 17 00:00:00 2001 From: RainX Date: Thu, 9 Nov 2017 09:56:03 +0800 Subject: [PATCH 1/3] change unit test timeout to 30 --- tests/test_exhq.py | 2 +- tests/test_hq.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_exhq.py b/tests/test_exhq.py index 1285901..d242e47 100644 --- a/tests/test_exhq.py +++ b/tests/test_exhq.py @@ -28,7 +28,7 @@ def test_all_functions(): api = TdxExHq_API(auto_retry=True) try: - with api.connect('121.14.110.210', 7727): + with api.connect('121.14.110.210', 7727, time_out=30): log.info("获取市场代码") data = api.get_markets() assert data is not None diff --git a/tests/test_hq.py b/tests/test_hq.py index 2928e1d..b8ff795 100644 --- a/tests/test_hq.py +++ b/tests/test_hq.py @@ -25,7 +25,7 @@ def test_all_functions(multithread, heartbeat, auto_retry, raise_exception): api = TdxHq_API(multithread=multithread, heartbeat=heartbeat, auto_retry=auto_retry, raise_exception=raise_exception) - with api.connect(): + with api.connect(time_out=30): log.info("获取股票行情") stocks = api.get_security_quotes([(0, "000001"), (1, "600300")]) assert stocks is not None From 3efbeb8c494709ceb7354e3ba5cffe88a8b66be8 Mon Sep 17 00:00:00 2001 From: JaysonAlbert Date: Thu, 9 Nov 2017 16:52:16 +0800 Subject: [PATCH 2/3] GetSecurityList name.rstrip("\x00") --- pytdx/parser/get_security_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytdx/parser/get_security_list.py b/pytdx/parser/get_security_list.py index aeb39b7..f2aa484 100644 --- a/pytdx/parser/get_security_list.py +++ b/pytdx/parser/get_security_list.py @@ -32,7 +32,7 @@ def parseResponse(self, body_buf): pre_close_raw, reversed_bytes2) = struct.unpack("<6sH8s4sBI4s", one_bytes) code = code.decode("utf-8") - name = name_bytes.decode("gbk") + name = name_bytes.decode("gbk").rstrip("\x00") pre_close = get_volume(pre_close_raw) pos += 29 From c6867c5cd8d88039adf0a13926c1995bb4ab883c Mon Sep 17 00:00:00 2001 From: RainX Date: Thu, 9 Nov 2017 17:40:00 +0800 Subject: [PATCH 3/3] raise to 1.57 --- ChangeLog.md | 4 ++++ setup.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index f3592b8..ca5a094 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +1.57 +----- +* GetSecurityList name.rstrip("\x00") Merge pull request #100 from JaysonAlbert/hotfix + 1.56 ------ * connect增加了time_out 参数 Merge pull request #99 from yutiansut/master diff --git a/setup.py b/setup.py index 3b7bd87..28c2ba3 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( name='pytdx', - version='1.56', + version='1.57', description='A Python Interface to TDX protocol', long_description=long_description, author='RainX',