Skip to main content

Scraping flight data from Google Flights and analyzing.

Project description

kcelebi License: MIT Live on PyPI

Flight Analysis

This project provides tools and models for users to analyze, forecast, and collect data regarding flights and prices. There are currently many features in initial stages and in development. The current features (as of 8/29/22) are:

  • Scraping tools for Google Flights
  • Base analytical tools/methods for price forecasting/summary
  • Models to demonstrate ML techniques on forecasting
  • API for access to previously collected data

Table of Contents

Overview

Flight price calculation can either use newly scraped data (scrapes upon running it) or cached data that reports a price-change confidence determined by a trained model. Currently, many features of this application are in development.

Usage

The web scraping tool is currently functional only for scraping round trip flights for a given origin, destination, and date range. It can be easily used in a script or a jupyter notebook.

Note that the following packages are absolutely required as dependencies:

  • tqdm
  • selenium (make sure to update your chromedriver!)
  • json

You can easily install this by running pip install -r requirements.txt.

The main scraping function that makes up the backbone of most other functionalities is scrape_data. Note that the cache parameter refers to whether this output should be saved in a caching system. See further documentation on caching (to be available soon).

# Parameter documentation
# scrape_data(origin : str, destination : str, date_leave : str, date_return : str, cache : bool = False) -> dict
# Try to keep the dates in format YYYY-mm-dd

result = scrape_data('JFK', 'IST', '2022-05-20', '2022-06-10')

# Can also input list of date strings for date_leave and date_return

leave_dates = ['2022-05-20', '2022-05-21', '2022-05-22']
return_dates = ['2022-06-10', '2022-06-11', '2022-06-12']
range_result = scrape_data('JFK', 'IST', leave_dates, return_dates)

Updates & New Features

Real Usage

Here are some great flights I was able to find and actually booked when planning my travel/vacations:

  • NYC ➡️ AMS (May 9), AMS ➡️ IST (May 12), IST ➡️ NYC (May 23) | Trip Total: $611 as of March 7, 2022

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

google-flight-analysis-0.0.7.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

google_flight_analysis-0.0.7-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file google-flight-analysis-0.0.7.tar.gz.

File metadata

File hashes

Hashes for google-flight-analysis-0.0.7.tar.gz
Algorithm Hash digest
SHA256 c6a500da7ab7b0ea3f758ad389f684f25c0d730aabf281360359cb75471fb51a
MD5 0108a415938b832bb9d664e9133a53fa
BLAKE2b-256 3bff11f46f054f753b7017459a457a9fe77faeecd1acf92e01c212ce953c3ec8

See more details on using hashes here.

File details

Details for the file google_flight_analysis-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for google_flight_analysis-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c35bc04c653eed410ec716670d715b13e439d9fc5263e1cf127551ad24be740e
MD5 e9b6de76c00fc126607979cc732e65bf
BLAKE2b-256 18835755ac148d856fd45fc0aeec3d29820cf1571ce9ef819beb94cffbf025ad

See more details on using hashes here.

Supported by

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