From b79f40afbe849f56f7c2db94e9bcebf3f5e92ec6 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 04 八月 2023 09:47:45 +0800 Subject: [PATCH] redis连接池归还 --- third_data/kpl_api.py | 71 +++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 1 deletions(-) diff --git a/third_data/kpl_api.py b/third_data/kpl_api.py index 7bc9e76..05eae55 100644 --- a/third_data/kpl_api.py +++ b/third_data/kpl_api.py @@ -23,6 +23,75 @@ raise Exception("璇锋眰鍑洪敊") result = response.text result = json.loads(result) + print(result) if int(result["errcode"]) != 0: return None - return result["ListJX"] + return result["ListJX"] if result["ListJX"] else result["List"] + + +# 鑾峰彇姒傚康浠g爜 +def getCodesByPlate(plate_code): + data = f"Order=1&a=ZhiShuStockList_W8&st=30&c=ZhiShuRanking&PhoneOSNew=1&old=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&IsZZ=0&Token=0&Index=0&apiv=w32&Type=6&IsKZZType=0&UserID=0&PlateID={plate_code}&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", + data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + return response.text + + +# 鑾峰彇姒傚康涓殑鏉垮潡寮哄害 +def getSonPlate(plate_code): + data = f"a=SonPlate_Info&apiv=w32&c=ZhiShuRanking&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&PlateID={plate_code}&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + return response.text + + +# 甯傚満琛屾儏-琛屼笟 +def getMarketIndustryRealRankingInfo(orderJingE_DESC=True): + data = f"Order={1 if orderJingE_DESC else 0}&a=RealRankingInfo&st=80&apiv=w32&Type=5&c=ZhiShuRanking&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&Index=0&ZSType=4&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", + data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + return response.text + + +# 甯傚満琛屾儏-绮鹃�� +def getMarketJingXuanRealRankingInfo(orderJingE_DESC=True): + data = f"Order={1 if orderJingE_DESC else 0}&a=RealRankingInfo&st=80&apiv=w32&Type=5&c=ZhiShuRanking&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&Index=0&ZSType=7&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", + data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + return response.text + + +# 鑾峰彇浠g爜鐨勭簿閫夋澘鍧� +# 杩斿洖鏍煎紡锛歔(鏉垮潡浠g爜,鏉垮潡鍚嶇О,娑ㄥ箙鐧惧垎姣�)] +def getCodeJingXuanBlocks(code): + data = f"a=GetStockIDPlate&apiv=w32&Type=2&c=StockL2Data&StockID={code}&PhoneOSNew=1&UserID=0&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&VerSion=5.8.0.2&Token=0&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + result = response.text + result = json.loads(result) + return result.get("ListJX") + + +# 鑾峰彇鑷敱娴侀�氬競鍊� +def getZYLTAmount(code): + data = f"a=GetStockPanKou_Narrow&apiv=w32&c=StockL2Data&VerSion=5.8.0.2&State=1&PhoneOSNew=1&DeviceID=a38adabd-99ef-3116-8bb9-6d893c846e23&StockID={code}&" + response = __base_request("https://apphq.longhuvip.com/w1/api/index.php", data=data) + if response.status_code != 200: + raise Exception("璇锋眰鍑洪敊") + result = response.text + result = json.loads(result) + if "real" in result: + return result["real"].get("actualcirculation_value") + return None + + +if __name__ == "__main__": + print(getZYLTAmount("000333")) -- Gitblit v1.8.0