我使用requests
库从REST API获取JSON响应。我的代码:
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":""
}
]
键列表在某些响应中有所不同。有什么线索的原因?