建议使用Amadeus API中的request_id参数来限制请求中包含的结果数量。请参考下面的代码示例:
import amadeus
amadeus = amadeus.Client(
client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET'
)
response = amadeus.shopping.flight_offers_search.get(
originLocationCode='SYD',
destinationLocationCode='BKK',
departureDate='2021-11-01',
adults=1,
max=10, # 限制返回结果的数量
request_id='uniqueStringHere' # 生成唯一的请求ID
)
以上示例中,我们通过将max参数设置为10来限制返回结果的数量,并使用一个唯一的字符串作为request_id参数,以确保每个请求具有唯一的ID。这将有助于确保在一个请求中只返回单个航段。