search

Home  >  Q&A  >  body text

How to solve the problem of no output after calling the api with Python?

After calling the api with Python, no json file appears. Instead, the following situation occurs, see screenshot.

from pprint import pprint
import requests
import json

token = 'EF8EA-070DF-BBEBE-EFDE4'
headers={"DAIWAN-API-TOKEN":token}
page=requests.get("http://lolapi.games-cube.com/GetChampionDetail?champion_id=1",headers = headers)
pprint(page.json)
巴扎黑巴扎黑2730 days ago720

reply all(2)I'll reply

  • 扔个三星炸死你

    扔个三星炸死你2017-06-12 09:21:53

    pprint(page.json())

    reply
    0
  • 三叔

    三叔2017-06-12 09:21:53

    See why after using requests.get URL, the .text response content is in the form of a dictionary, but type it is str

    page.json()
    

    or

    eval(page.text)
    

    reply
    0
  • Cancelreply