📌  相关文章
📜  如何在 python 代码示例中从 json web api 获取数据

📅  最后修改于: 2022-03-11 14:46:18.388000             🧑  作者: Mango

代码示例1
import requests
import simplejson as json

url = "api_url"
response = requests.get(url)
x = json.loads(response.text)

#Note the {} get auto replace by the data you were looking for
print('protocol: {}'.format(x.get('protocol'))) #replace 'protocol' with the data specific you need like 'id'
print('responseTime: {}'.format(x.get('responseTime')))
print('reputation: {}'.format(x.get('reputation')))