在发送 API 请求时,需要设置 "pagesize" 参数。默认情况下,Airtable API 返回的记录数是默认值(通常不超过100个记录)。因此,您需要将“pagesize”参数设置为更大的数字,以确保所有记录都被返回。下面是一个示例:
import requests
import json
# Set up the API endpoint and parameters
url = "https://api.airtable.com/v0/[YOUR_BASE_ID]/[YOUR_TABLE_NAME]"
params = {
"pageSize": 1000, # Set the number of records to return
"view": "Grid view" # Optionally specify a view to use
}
# Set up the API headers and authorization
headers = {
"Authorization": "Bearer [YOUR_API_KEY]"
}
# Send the API request and parse the response
response = requests.get(url, headers=headers, params=params)
records = response.json()["records"]
在上面的代码中,我们设置了“pagesize”参数为1000,以返回更多的记录。请根据您的需要适当地设置这个数字。