【发布时间】:2020-11-18 00:15:59
【问题描述】:
抱歉标题难以理解,希望我能澄清一下。第一部分代码工作正常,但现在我想将所有“uuid”插入请求中,并在 for 循环中从每个请求中获取一些东西,也许。
import requests
import json
uuids = []
count = 0
catacombs = []
data = requests.get("https://api.hypixel.net/guild?key=42d64fe9-677c-433b-9460-f0177e0b9ded&id=5f1654598ea8c918612a6a43").json()
for guild in data["guild"]["members"]:
uuids.append(guild["uuid"])
而不是这个...
data = requests.get("https://api.hypixel.net/skyblock/profile?key=42d64fe9-677c-433b-9460-f0177e0b9ded&profile=0baac74f903143e49d24015d8bc3a733").json()
print(data)
我想像这样从先前获取的列表中获取第二个参数“profile”。
data = requests.get("\"https://api.hypixel.net/skyblock/profile?key=42d64fe9-677c-433b-9460-f0177e0b9ded&profile=" + str(uuids[count]) + "\"").json()
print(data)
我遇到了一大堆错误,我什至不知道从哪里开始解决这个问题。如果需要,我会澄清。在此先感谢您,再次对任何混淆表示歉意。
【问题讨论】:
标签: python json api web-scraping