Hello
I was hoping if someone could help me , I have been given a small group project as part of training course and ive to make something thats to track a flight arrival time. Unfortunately i dont have any experience in Python but this is the language im expected to do this in. Ive tried following the online documentation however i keep getting an error.
Could someone please help me identify what is wrong with my code
import requests
username = ‘2ThePoint’
apiKey = ‘0bb6…c59’
fxmlUrl = “https://flightxml.flightaware.com/json/FlightXML3/”
payload = {‘ident’:‘EZY215’, ‘howMany’:‘1’}
response = requests.get(fxmlUrl + “AirportBoards”, params=payload, auth=(username, apiKey))
if response.status_code == 200:
print (“Aircraft enroute to Glasgow:”)
decodedResponse = response.json()
for flight in decodedResponse[‘AirportBoardsResult’][‘enroute’][‘flights’]:
print (“{}\t{} ({})”.format(flight[actualarrivaltime],flight[‘odestinationCity’], flight[‘origin’]))
else:
print (“There was an error retrieving the data from the server.”)
Many Thanks