FlightAware Discussions

Any idea why the API would return a 401

I’ve double checked my key. Im using a version of the “Over Austin” tweet bot if that makes any difference ?

Also how many queries do I get for free (if any) as a feeder ? TIA

and here is the python… import traceback

import requests

def FlightInfo(ident, username, apiKey, verbose=0, results=10):
fxmlUrl = “https://flightxml.flightaware.com/json/FlightXML3/
ident = ident.strip()
payload = {‘ident’:ident, ‘howMany’:results}
response = requests.get(fxmlUrl + “FlightInfoStatus”, params=payload, auth=(username, apiKey))
output = dict()
if response.status_code == 402:
return False
if response.status_code == 200:
decodedResponse = response.json()
if ‘FlightInfoStatusResult’ not in decodedResponse:
return False
for flight in decodedResponse[‘FlightInfoStatusResult’][‘flights’]:
if ‘status’ not in flight:
if flight[‘status’].startswith(‘On’) or flight[‘status’].startswith(‘En’) or flight[‘status’].startswith(‘In’):
output = {
if verbose:
return decodedResponse
return output
print(“FA API status code: {}”.format(response.status_code))
return False
except Exception:
print(“exception in fa_api.FlightInfo():”)
return False

Your account only has a FlightXML 2 API key, but your code is attempting to access a FlightXML 3 (beta) method which requires a FlightXML 3 API key.

At this time we are no longer accepting new users to join the FlightXML 3 beta testing program, which is unfortunately the only way we were providing feeders with free limited access to our FlightXML APIs.