我使用requests
库从 REST API 获取 JSON 响应。我的代码:
import json
import requests
response = requests.get(url, params=payload, auth=(user, pwd), headers=headers )
data = response.json()
with open(completeName, 'w+') as fd:
json.dump(data, fd, indent=4)
JSON文件内容:
"records":[
{
"parent":"",
"caused_by":"",
"watch_list":"",
"u_closure_code":""
},
{
"parent":"",
"caused_by":"",
"watch_list":""
}
]
键列表在某些响应中有所不同。任何线索为什么?