I'm trying to run an API with multiple zip codes in order to store json files into a dataframe. But, I'm getting an error when I try to pass a list with more than one zip code:
ceps = ['69027320', '38411206', '78118187', '12245481']
jsonfile = []
for cep in ceps:
url = "https://www.cepaberto.com/api/v3/cep?cep="+str(cep)
headers = {'Authorization': 'Token token=111111111111111111111111111111'}
response = requests.request("GET", url.format(cep=ceps), headers=headers)
jsonfile.append(response.json())
df = pd.json_normalize(jsonfile)
Error output:
JSONDecodeError: Extra data: line 1 column 5 (char 4)
I can visualize that the error happens because I try to analyze several objects without wrapping them in an array. But, I can't think of a solution to make it work