Skip to content

riverbed/FlyFast-FlightSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlyFast - FlightSearch

This repository contains the source code for the FlightSearch of FlyFast.

For the source code of the WebUI, head over to the WebUI. This will provide a WebUI to make calls to the FlightSearch.

To view the full source code and to run the whole application through Docker, head over to FlyFast.

Requirements

  1. Git (Optional)
  2. a Docker host, for example Docker Desktop (Optional)
  3. Python 3.7 (Required)
  4. WebUI (Required Only For Having A UI)

Getting Started

  1. Clone/download this repository.
    git clone https://github.com/Aternity/FlyFast-FlightSearch.git
    
  2. Using the terminal, change the directory to the folder of this project.
    cd FlyFast-FlightSearch
    
  3. You can either start the application using Python or Docker.

Step by Step Using Python

  1. Install the dependencies required to run this application:
    pip install -r requirements.txt
    
  2. Make sure to set the environment variables for the application.
    • COLLECTOR_URL is the APM Collector URL, which should be on port 55681, if you are using the Aternity APM Collector.

      For example, with Bash:

      export COLLECTOR_URL="http://localhost:55681/v1/traces"
      

      or with Powershell:

      $env:COLLECTOR_URL="http://localhost:55681/v1/traces"
      
  3. Start the application and open http://localhost:8080 to view it in your browser.
    py src/main.py
    

Step by Step Using Docker

  1. Build our docker:
    docker build . -t flyfast-flightsearch
    
  2. Run our docker container, make sure to set the environment variables for the application:
    • COLLECTOR_URL is the APM Collector URL, which should be on port 55681, if you are using the Aternity APM Collector.
    docker run --rm -p 8080:8080 -e COLLECTOR_URL=http://localhost:55681/v1/traces flyfast-flightsearch
    
  3. Open http://localhost:8080 to view it in your browser.

API Request

Functionality API Request Fields
Airport Typeahead /flightsearchapi/airportypeahead?searchtxt=${text}&limit=${limit} - text - text
- limit - limit response
Single Trip /flightsearchapi/searchflight?from=${from}&to=${to}&departure=${departureDate}&seat=${seatType} - from - 3 Letter Airport
- to - 3 Letter Airport
- departureDate - MM-DD-YYYY
- seatType - Economy, Premium Economy, Business, First
Round Trip /flightsearchapi/searchflight?from=${from}&to=${to}&departure=${departureDate}&return={returnDate}&seat=${seatType} - from - 3 Letter Airport
- to - 3 Letter Airport
- departureDate - MM-DD-YYYY
- returnDate - MM-DD-YYYY
- seatType - Economy, Premium Economy, Business, First

API Response

Airport Typeahead Response

[
  {
    "value": ${airport},
    "name": ${airportName},
    "city": ${city},
    "country": ${country}
  }
]

Single Trip Response

[
  [
    {
      "from": ${from}, 
      "to": ${to}, 
      "flights": [
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        },
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        }
      ],
      "departureTime": ${departureTime}, 
      "arrivalTime": ${arrivalTime}, 
      "fare": ${fare}
    }
  ]
]

Round Trip Response

response[0][0] - Contains to flight details

response[0][1] - Contains return flight details

[
  [
    {
      "from": ${from}, 
      "to": ${to}, 
      "flights": [
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        },
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        }
      ],
      "departureTime": ${departureTime}, 
      "arrivalTime": ${arrivalTime}, 
      "fare": ${fare}
    }
  ],
  [
    {
      "from": ${from}, 
      "to": ${to}, 
      "flights": [
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        },
        { 
          "id": ${id},
          "flightNumber": ${flightNumber},
          "airline": ${airline},
          "from": ${from}, 
          "to": ${to}, 
          "departureTime": ${departureTime}, 
          "arrivalTime": ${arrivalTime}, 
          "seat": ${seat},
          "fare": ${fare}
        }
      ],
      "departureTime": ${departureTime}, 
      "arrivalTime": ${arrivalTime}, 
      "fare": ${fare}
    }
  ]
]

License

Copyright (c) 2022 Riverbed Technology, Inc.

The contents provided here are licensed under the terms and conditions of the MIT License accompanying the software ("License"). The scripts are distributed "AS IS" as set forth in the License. The script also include certain third party code. All such third party code is also distributed "AS IS" and is licensed by the respective copyright holders under the applicable terms and conditions (including, without limitation, warranty and liability disclaimers) identified in the license notices accompanying the software.