我(似乎)成功地使用分页通过 Python API 调用遍历 Airtable 记录。但是我无法理解如何从第一次调用中附加数据并且所有迭代都得到调用。我的代码如下:
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
}
}]
}
然后我尝试创建附加数据集的数据框。我在循环中的哪个位置附加数据?