GithubHelp home page GithubHelp logo

dkotschessa / faker_airtravel Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 9.0 244 KB

A community provider for the python faker library to fake airline data for testing purposes.

Home Page: https://pypi.org/project/faker_airtravel/

License: MIT License

Python 100.00%
airtravel faker testing

faker_airtravel's Introduction

Airtravel provider for Faker

Acknowlegements

faker_airtravel is a provider for the Faker Python package, and a fork of https://github.com/kennethwsmith/faker_vehicle. I would like to thank the maintainer of that repository, since I used the structure to create this one.

Description

faker_airtravel provides airtravel related fake data for testing purposes. The definition of "fake" in this context really means "random," as the airport codes, cities, and locations are real. However, I make no claims about accuracy, so do not use this as location data!

Installation

Install with pip:

pip install faker_airtravel

Add as a provider to your Faker instance:

from faker import Faker
from faker_airtravel import AirTravelProvider
fake.add_provider(AirTravelProvider)

If you already use faker, you probably know the conventional use is:

fake = Faker()

Airport Object

>>> fake.airport_object()
{'airport': 'Tocumen International Airport',
'iata': 'PTY',
'icao': 'MPTO',
'city': 'Tocumen',
'state': 'Panama',
'country': 'Panama'}

>>> fake.airport_name()
'Lisbon Airport'

Airport Codes (IATA and ICAO)

>>> fake.airport_iata()
'LSC'

>>> fake.airport_icao()
'KOKC'

Airlines

>>> fake.airline()
'Sichuan Airlines'

Flight

The flight object is an example of how the data might be combined to create larger structures, and may not be the exact format you need. However it does have the advantage that it will never choose the same 'origin' and 'destination' object.

>>>fake.flight()

{'airline': 'Maya Island Air',
 'origin': {'airport': 'Noi Bai Airport',
  'iata': 'HAN',
  'icao': 'VVNB',
  'city': 'Hanoi',
  'state': 'Ha Noi',
  'country': 'Vietnam'},
 'destination': {'airport': 'Geneva Airport',
  'iata': 'GVA',
  'icao': 'LSGG',
  'city': 'Geneva',
  'state': 'Canton of Geneva',
  'country': 'Switzerland'},
 'stops': 'non-stop',
 'price': 641}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.