Skip to main content

A helper that interacts with low-cost air carrier's API and helps to find cheap flights.

Project description

Flight Finder App is a Python package for searching flights (only Ryanair at the moment). It provides Command-line interface (CLI) capabilities for aquick and simple search or could be used as a library in your code.

Installation

pip install -i https://test.pypi.org/simple/ FlightFinderApp-JG

Using command-line interface

Flight Finder App CLI provides two commands:

  • findFlights
  • findAirportCode
Usage: FlightFinderApp findflights [OPTIONS]

Options:
  -d, --departurecode TEXT       The starting point of your trip. Specify your
                                 departure airport code
  -a, --arrivalcode TEXT         The final point of your trip. Specify your
                                 arrival airport code
  -r, --includereturnflight      Includes return flights into search results
  -o, --outbounddatefrom TEXT    Start date of your trip. If not specified,
                                 then today date is set
  -p, --pricevalue INTEGER       Max price for one way / return flights. It
                                 does not apply to total price of connecting
                                 flights  [default: 999]
  -f, --dateflexibility INTEGER  Extends the search period by so many days
                                 (outbound date +/- date flexibility)
                                 [default: 2]
  -t, --tripduration INTEGER     Date of the return flight is set by adding
                                 the trip duration to outbound date  [default:
                                 7]

Usage: FlightFinderApp findairportcode [OPTIONS]

Options:
  --city TEXT     Returns a list of airport codes that are bases of Ryanair in
                  the specified city
  --country TEXT  Returns a list of cities and airport codes that are bases of
                  Ryanair in the specified country

Using as a library

Creating an instance:

from FlightFinderApp_JG.FlightManager import RyanairFlights

ryanairFlights = RyanairFlights()

All you need is the find_flights function. To search for a return flight between two airports which price is bellow 50Eur

ryanairFlights.find_flights(departure_airport_code="KUN",
                            arrival_airport_code="BER",
                            is_return_trip=True,
                            price_value_to=50)

Result:

{
  "outbound": {
    "departureCountry": "Lithuania",
    "departureCity": "Kaunas",
    "departureIATACode": "KUN",
    "arrivalCountry": "Germany",
    "arrivalCity": "Berlin",
    "arrivalIATACode": "BER",
    "departureDate": "2024-05-14T09:50:00",
    "arrivalDate": "2024-05-14T10:30:00",
    "price": 21.99,
    "currency": "EUR",
    "priceUpdatedOn": 1715243865000
  },
  "summary": {
    "price": 34.98,
    "currency": "EUR",
    "tripDuration": 7
  },
  "inbound": {
    "departureCountry": "Germany",
    "departureCity": "Berlin",
    "departureIATACode": "BER",
    "arrivalCountry": "Lithuania",
    "arrivalCity": "Kaunas",
    "arrivalIATACode": "KUN",
    "departureDate": "2024-05-21T06:35:00",
    "arrivalDate": "2024-05-21T09:10:00",
    "price": 12.99,
    "currency": "EUR",
    "priceUpdatedOn": 1715237050000
  }
}

If no results are returned, try to specify the following parameters:

  • date_flexibility_in_days
  • trip_duration_in_days
ryanairFlights.find_flights(departure_airport_code="KUN",
                            arrival_airport_code="BER",
                            is_return_trip=True,
                            price_value_to=50,
                            date_flexibility_in_days=5,
                            trip_duration_in_days=10)

If direct flight between two airports is not found, then a connecting flight could be suggested (if such exists, remember, we're operating only with Ryanair flights)

Searching for a flight between two airports, but we already know that direct flight does not exist. Also, we have defined our trip start date:

ryanairFlights.find_flights(departure_airport_code="KUN",
                            arrival_airport_code="OPO",
                            is_return_trip=True,
                            outbound_date="2024-06-10",
                            date_flexibility_in_days=10,
                            trip_duration_in_days=10)

Result:

{
  "outbound": {
    "toConnecting": {
      "departureCity": "Kaunas",
      "departureIataCode": "KUN",
      "arrivalCity": "Alicante",
      "arrivalIataCode": "ALC",
      "departureDate": "2024-06-04T06:00:00",
      "arrivalDate": "2024-06-04T09:00:00",
      "price": 97.81,
      "currency": "EUR",
      "priceUpdatedOn": 1715247806000
    },
    "fromConnecting": {
      "departureCity": "Alicante",
      "departureIataCode": "ALC",
      "arrivalCity": "Porto",
      "arrivalIataCode": "OPO",
      "departureDate": "2024-06-05T11:40:00",
      "arrivalDate": "2024-06-05T12:20:00",
      "price": 19.99,
      "currency": "EUR",
      "priceUpdatedOn": 1715236900000
    },
    "summary": {
      "timeBetweenFlights": "1 day, 2:40:00"
    }
  },
  "inbound": {
    "toConnecting": {
      "departureCity": "Porto",
      "departureIataCode": "OPO",
      "arrivalCity": "Alicante",
      "arrivalIataCode": "ALC",
      "departureDate": "2024-06-20T10:55:00",
      "arrivalDate": "2024-06-20T13:30:00",
      "price": 19.99,
      "currency": "EUR",
      "priceUpdatedOn": 1715236759000
    },
    "fromConnecting": {
      "departureCity": "Alicante",
      "departureIataCode": "ALC",
      "arrivalCity": "Kaunas",
      "arrivalIataCode": "KUN",
      "departureDate": "2024-06-22T07:10:00",
      "arrivalDate": "2024-06-22T12:00:00",
      "price": 162.99,
      "currency": "EUR",
      "priceUpdatedOn": 1715247391000
    },
    "summary": {
      "timeBetweenFlights": "1 day, 17:40:00"
    }
  },
  "tripSummary": {
    "totalPrice": "300.78",
    "tripDuration": "18 days, 6:00:00",
    "timeInDestination": "14 days, 22:35:00"
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flightfinderapp_jg-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flightfinderapp_jg-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file flightfinderapp_jg-0.1.0.tar.gz.

File metadata

  • Download URL: flightfinderapp_jg-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for flightfinderapp_jg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab8368ef814af9b3e32a8833899793633ee596289b5c6c9bed478674eef76a6b
MD5 93bc234f7601b62a0bf850afcabe68fc
BLAKE2b-256 3c9195fcc5d6dba7624ac2fa9d65aae63f2d0b3b5240deb0e41f5c6fad58f6be

See more details on using hashes here.

File details

Details for the file flightfinderapp_jg-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flightfinderapp_jg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1301aff6758080e5fd2a1ca9e4be2cfcb0b51ee04aa4536608f57ad3228f366e
MD5 81509428dc3fcfa35a8fded660605919
BLAKE2b-256 693257a9d63a4971442de03dc73d6e71de909ed2210150815ffce0d9be9044c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page