AirlineFlightSchedules limit of 150 records

Context: Python, Flightaware ‘Silver Package’. AirlineFlightSchedules returns 150 records when queried for 1 day, however, the code below performs a query over several days and continues to return only 150 records. Therefore, I believe there is mechanism limiting the number of records returned.

Visualize the 150 records: Open the JSON viewer at codebeautify dot org slash jsonviewer Paste the raw json data URL https://pastebin.com/raw/nqKvqR5

Note that in the code:

  • MaxResults=2500
  • SetMaximumResultSize is configured with payload = {‘max_size’ : int(MaxResults)}
  • AirlineFlightSchedules is configured with payload: ‘howMany’ : int(MaxResults)

UPDATE

The 150 record limit is a system limit. I think that several queries can be sequentially performed. The pseudo code would be:

recordBlock=0
While response.RecordsReturned != 150
++recordBlock #point to the next 150 records
response = requests.get(fxmlUrl + “AirlineFlightSchedules”,params=payload, auth=(username, apiKey)) #get next 150 records
save 150 records to text file
end while

QUESTIONS

Is there another parameter that needs to be configured? NO: 150 record limit is a system limit
Where to begin troubleshooting to determine root cause? NONE: 150 record limit is a system limit
What is the reason for the 150 record limit? Can this raised to 1000?
Is there a simple command to determine the number of records returned?

import requests, time, json

timestr = time.strftime(“%Y%m%d-%H%M%S”)
username = “myUsername”
apiKey = “myApiKey”
fxmlUrl = “https://flightxml.flightaware.com/json/FlightXML3/

MaxResults = 10*250
print “MaxResults=” + str(MaxResults)
payload = {‘max_size’ : int(MaxResults)}
response = requests.get(fxmlUrl + “SetMaximumResultSize”,params=payload, auth=(username, apiKey))

#airlines = [‘B6’, ‘HA’, ‘TP’, ‘EI’] #Loop through each carrier
airlines = [‘B6’]
for airline in airlines:
print airline
t1 = int(time.mktime(time.strptime(“20.05.2018”, “%d.%m.%Y”)))
t2 = int(time.mktime(time.strptime(“29.05.2018”, “%d.%m.%Y”)))
payload = {‘start_date’ : str(t1), ‘end_date’ : str(t2), ‘origin’ : ‘KJFK’, ‘airline’ : airline, ‘exclude_codeshare’ : ‘True’, ‘howMany’ : int(MaxResults), ‘offset’ : ‘0’}
response = requests.get(fxmlUrl + “AirlineFlightSchedules”,params=payload, auth=(username, apiKey))

if response.status_code == 200:
outputfilename = “AirlineFlightSchedules_” + airline + “_” + timestr + “.json” #each carrier has its .json file
print outputfilename
with open(outputfilename, ‘w’) as outfile:
json.dump(response.json(), outfile)
else:
print “Error executing request: Response code not 200. Response=” + str(response.status_code)

Hi,

The record limit is primary in place for performance reasons, so that it’s not possible to flood the system with many very large queries. Also, the “SetMaximumResultSize” is only a function in FlightXML 2. In FlightXML 3 this value is determined by your subscription.

There’s no ability to determine how many records will be returned before the request is made. This is because the number of records returned depends on the request parameters. The howMany can provide an upper bound on what to expect per request.

The offset input and the nextOffset return value can be used to page through results. If the nextOffset value is greater than zero it can be used as the next request’s offset value to pull the next page of results set. A value of -1 indicates there are no more results.