【发布时间】:2022-01-14 21:03:11
【问题描述】:
我有这个 API 响应,我想获取一些值并将它们存储为 Python BOT 的变量,例如“floor_price”(我想要它后面的整数),但由于某种原因,它无法正常工作,它一直给我错误,但是当我使用“统计”尝试它时,它可以工作并提供一切。
APIhttps://api.opensea.io/api/v1/collection/ogcats-harvest-galaxy/stats
url = "https://api.opensea.io/api/v1/collection/ogcats-harvest-galaxy/stats"
headers = {"Accept": "application/json"}
response = requests.request("GET", url)
json_response = response.json()
floor= json_response['floor_price']
请帮忙:)
【问题讨论】:
-
如果该 sn-p 正是程序运行的方式,您将需要删除标题和地板的单个空格缩进
-
肯定是 json_response["stats"]["floor_price"] 不?
-
@kindall 谢谢你,很有魅力。