我正在开发一个从 Binance API 获取烛台数据的电报机器人。我无法获得 JSON 数据作为响应。以下代码是我尝试过的。
import requests
import json
import urllib.request
`url = "https://api.binance.com/api/v1/klines"
response = requests.request("GET", url)
print(response.text)`
期望的输出:
[
[
1499040000000, // Open time
"0.01634790", // Open
"0.80000000", // High
"0.01575800", // Low
"0.01577100", // Close
"148976.11427815", // Volume
1499644799999, // Close time
"2434.19055334", // Quote asset volume
308, // Number of trades
"1756.87402397", // Taker buy base asset volume
"28.46694368", // Taker buy quote asset volume
"17928899.62484339" // Ignore
]
]
问题编辑:
我得到的输出是:
`{"code":-1102,"msg":"Mandatory parameter 'symbol' was not sent, was empty/null, or malformed."}'