0

I use requests library to fetch JSON response from REST API. My code:

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 file contents:

"records":[
{
    "parent":"",
     "caused_by":"",
    "watch_list":"",
    "u_closure_code":""
}, 
 {
    "parent":"",
    "caused_by":"",
    "watch_list":""
}
]

The list of Keys differs in some response. Any clue why?

Martin Gergov
  • 1,556
  • 4
  • 20
  • 29

0 Answers0