Python 3 Get and parse JSON API

前端 未结 5 1177
醉梦人生
醉梦人生 2021-01-31 14:58

How would I parse a json api response with python? I currently have this:

import urllib.request
import json

url = \'https://hacker-news.firebaseio.com/v0/topsto         


        
5条回答
  •  时光取名叫无心
    2021-01-31 15:07

    With Python 3

    import requests
    import json
    
    url = 'http://IP-Address:8088/ws/v1/cluster/scheduler'
    r = requests.get(url)
    data = json.loads(r.content.decode())
    

提交回复
热议问题