Skip to content

Instantly share code, notes, and snippets.

@martin-kokos
Last active January 15, 2018 09:41
Show Gist options
  • Save martin-kokos/d578679d97eb1652dfeb3e7f2a4e115b to your computer and use it in GitHub Desktop.
Save martin-kokos/d578679d97eb1652dfeb3e7f2a4e115b to your computer and use it in GitHub Desktop.
Kiwi.com _Python víkend_ task

Kiwi.com Python víkend task

If you have applied for our Python vikend course this task serves to asess if you have sufficient knowledge to enjoy and learn something on our course.

Task

Your task is to use our flights API to find a flight and book the flight on the booking API. If it sounds too complicated. Don't worry, it's not.

APIs

Flights

We at Kiwi.com use simple APIs based on HTTP, usually with payload in JSON format. If you've never used an API click here:

https://api.skypicker.com/flights?v=3&daysInDestinationFrom=6&daysInDestinationTo=7&flyFrom=49.2-16.61-250km&to=dublin_ie&dateFrom=03/04/2018&dateTo=09/04/2018&typeFlight=return&adults=1&limit=60

Now you have. Our API for searching flights is public, so you can find the documentation in Apiary http://docs.skypickerpublicapi.apiary.io/#reference/flights

Booking

Searching for the flight was pretty easy. To book the flight, you'll need to use the booking API (which has been created solely for the purpose of the task and no payment is required). The world is not perfect and not everything is documented so there is no documentation provided for this API.

The booking API endpoint: http://128.199.48.38:8080/booking

You'll just have to figure out how it works and book the flight. Good luck!

Requirements

  • The solution must be written in Python 3 (or 2 if you must)

  • The following invocations of your program must work

    • ./book_flight.py --date 2018-04-13 --from BCN --to DUB --one-way
    • ./book_flight.py --date 2018-04-13 --from LHR --to DXB --return 5
    • ./book_flight.py --date 2018-04-13 --from NRT --to SYD --cheapest --bags 2
    • ./book_flight.py --date 2018-04-13 --from CPH --to MIA --fastest

    where --one-way (make this the default option) indicates need of flight only to location and --return 5 should book flight with passenger staying 5 nights in destination,

    --cheapest (default) will book the cheapest flight and --fastest will work similarly

    The program will output a PNR number which serves as confirmation of booking. In case of failure, program will exit with non-zero exit code.

    The --from and --to parameters only need to support airport IATA codes

Submitting

Please send your coded solutions to pythonvikend@kiwi.com , most preferably posted online on places like GitHub or elsewhere, but attachment files are also OK, I guess, if you don't wish to publish it.

During the submission period we want to keep it fair for everybody, so we will not provide you with feedback on your code (apart from clarifying instructions). Do the best you can, keep it is simple ... but neat, focus on practicality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment