From 00fbda853ed12e1d74b1278de27e179be537d487 Mon Sep 17 00:00:00 2001 From: tzquant_zq Date: Mon, 9 Sep 2024 21:15:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'GetCoinInfo.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GetCoinInfo.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 GetCoinInfo.py diff --git a/GetCoinInfo.py b/GetCoinInfo.py new file mode 100644 index 0000000..6f244b1 --- /dev/null +++ b/GetCoinInfo.py @@ -0,0 +1,22 @@ +import requests + +def GetCoinInfo(coin, settle): + url = "http://43.133.213.20:8001/api/v1/GetCoinInfo/" + payload = {"coin": coin, "settle": settle} + + response = requests.post(url, json=payload, timeout=5) + + if response.status_code == 200: + return response.json() + else: + print(f"Error: {response.status_code}, {response.json()}") + return None + + +# 示例参数 +coin = "btc" +settle = "usdt" + +# 发送请求 +CoinInfo = GetCoinInfo(coin, settle) +print(CoinInfo) \ No newline at end of file