DataFrame处理接口返回数据

import requests
from pandas import DataFrame

url = "***"
payload = '***'
headers = {
    'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request("POST", url, headers=headers, data=payload).json()
print(response.keys())
'''
dict_keys(['totalPages', 'totalCount', 'nextPage', 'result'])
'''

res_list = DataFrame(response["result"],columns=["name","id"])
print(res_list)
'''
    name      id
0   name1  1331372814151570241
1   name2  1331372814215670256
'''

 

posted @ 2021-02-20 17:25  OTAKU_nicole  阅读(215)  评论(0编辑  收藏  举报