airportsdata icon indicating copy to clipboard operation
airportsdata copied to clipboard

[FEATURE] Add possibility to find an airport

Open rignaneseleo opened this issue 1 year ago • 1 comments

Hi, great library. I am wondering if you could implement a function to search for an airport, given the city name, the airport name, the airport code or a portion of them.

Example:

import airportsdata
airports_db = airportsdata.load()

#returns a list of airports in Milan
airports = airports_db.search("Milan")

#returns FCO airport in Rome
airports = airports_db.search("Fiumicino")

#returns Eindhoven airport in Netherlands
airports = airports_db.search("EIN")

I guess you can easily do this by merging airport name, city and airport code and then use .contains(query) on that value. The result is approximative but still valuable I think.

What do you think? Thanks!

rignaneseleo avatar Oct 31 '22 13:10 rignaneseleo