HomePortfolio → Airlines


January 20, 2020

Made with: Python

Project Summary:

Submit the name of an airline and get its 2-charachter IATA symbol

Source Files

With this simple app we can type the name (or part of the name) of an airline in the form, and when we hit submit we will get a list of airlines that match that input followed by its IATA symbol. For example, you can type “american” in the search box:

And when you click “Submit” the result will be a list of all the airlines that have “american” in their name, followed by their IATA symbol in parentheses:

If you're more specific and type only “american airlines”, you'll get just American Arilines and its symbol: AA.

The program is made in Python, with the aid of Flask and Jinja to display the results on a web page.

First, the program takes a JSON file with all airline/symbol combinations and transforms it into a list of tuples. Each tuple is in the form of (‘Symbol’, “Airline Name’).

Next, we iterate over all the tuples in the list and append them to a new list of tuples where the airline name matches the pattern you input.

Finally, we display the list of results on a webpage, using Flask and a Jinja template.

To run this code on your computer you first need to install and import the following dependencies at the top of your application.py file:

import json

from flask import Flask, redirect, render_template, request

Click here for the source code.

tech python flask jinja

© 2020 MSC | Powered by