I have been using the below script for several months now. it takes a file containing a list of ident codes, then passes each one to the API call, outputting the info I’m looking for.
until a couple days ago, this was working perfectly, but now I am getting “no data found” for every flight I pass.
QFA412, for example…
#!/usr/local/bin/ruby
require “#{ENV’SCRIPTS_PATH’]}/FlightXML2Driver.rb”
username = ENV’FLIGHTAWARE_USERNAME’]
apiKey = ENV’FLIGHTAWARE_API_KEY’]
input_file_path=ENV’INPUT_FILE_PATH’]
output_file_path=ENV’OUTPUT_FILE_PATH’]
puts “connecting to FlightAware web service…”
$api = FlightXML2Soap.new(username, apiKey)
puts “opening file #{output_file_path} for output…”
output_file=File.open(output_file_path,‘w’)
def output_flight_info(ident,output_file)
result = $api.flightInfo(FlightInfoRequest.new(ident,15))
result.flightInfoResult.flights.each do |x|
output_file.print "#{x.ident}|"
output_file.print "#{x.aircrafttype}|"
output_file.print "#{x.origin}|"
output_file.print "#{x.destination}|"
output_file.print "#{Time.at(x.filed_departuretime).utc}|"
if x.actualdeparturetime>0 then
output_file.puts "#{Time.at(x.actualdeparturetime).utc}"
else
output_file.puts ''
end
end
end
puts “opening file #{input_file_path} for input and iteration…”
File.open(input_file_path,‘r’).each do |flight|
begin
output_flight_info(flight,output_file)
rescue => e
puts “error occurred with #{flight}”
puts e.message
end
end
puts “process completed!”