ezKit 1.8.4__tar.gz → 1.8.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.8.4
3
+ Version: 1.8.6
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -200,6 +200,11 @@ def latest_data(
200
200
  # 转换数据类型
201
201
  response_dict: dict = response.json()
202
202
 
203
+ # 判断数据是否正确
204
+ if True not in [utils.v_true(response_dict["data"], dict), utils.v_true(response_dict["data"], list)]:
205
+ logger.error(f"{info} [失败]")
206
+ return None
207
+
203
208
  # ------------------------------------------------------------------------------------------
204
209
 
205
210
  # 个股
@@ -254,3 +259,36 @@ def latest_data(
254
259
  logger.error(f"{info} [失败]")
255
260
  logger.exception(e)
256
261
  return None
262
+
263
+
264
+ # --------------------------------------------------------------------------------------------------
265
+
266
+
267
+ def plate_codes(plate: str) -> list | None:
268
+ """获取板块成分股代码"""
269
+
270
+ if utils.v_true(plate, str) is False:
271
+ logger.error("Incorrect function argument type: plate")
272
+ return None
273
+
274
+ info: str = "获取板块成分股代码"
275
+
276
+ try:
277
+
278
+ logger.info(f"{info} ......")
279
+
280
+ items = latest_data(payload=plate, data_type="plate")
281
+
282
+ if isinstance(items, list):
283
+ codes: list = [stock.coderename(i["secu_code"], restore=True) for i in items]
284
+ codes.sort()
285
+ logger.success(f"{info} [成功]")
286
+ return codes
287
+
288
+ logger.error(f"{info} [失败]")
289
+ return None
290
+
291
+ except Exception as e:
292
+ logger.error(f"{info} [失败]")
293
+ logger.exception(e)
294
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.8.4
3
+ Version: 1.8.6
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -3,7 +3,7 @@ from setuptools import find_packages, setup
3
3
 
4
4
  setup(
5
5
  name='ezKit',
6
- version='1.8.4',
6
+ version='1.8.6',
7
7
  author='septvean',
8
8
  author_email='septvean@gmail.com',
9
9
  description='Easy Kit',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes