I've (seemingly) successfully used pagination to iterate through Airtable records through a Python API call. But I'm having trouble understanding how to append the data from the first call and all of the iterations get calls. My code is below:
while offset is not None:
next_url = url +'&offset='+ offset
next_response = requests.get(next_url, params=params, headers=headers)
output = next_response.json()
for record in output["records"]:
print(json.dumps(record))
if "offset" in output:
offset = output["offset"]
else:
offset = None
x = pd.DataFrame(output)
x = x['records'].apply(pd.Series)
x = x['fields'].apply(pd.Series)
print(x)
Series = {'offset': 'itrSuqdXIeBNUIR9R/rec0Nx6MPArR8mew8',
'records': [{'createdTime': str,
'fields': {'*CHANNEL': str,
'*START/LAUNCH/LOTS': str,
'*STATUS': str,
'CREATIVE OPS': str
}
}]
}
I'm then trying to create a data frame of the appended dataset. Where in the loop do I append the data?