Daily Python
Published in

Daily Python

Python script to search flights using Goibibo API | Daily Python #25

This article is a tutorial on how to search for flights by consuming the Goibibo API in Python.


  1. Python 3.0
  2. Pip

Install the following packages:

  1. requests — Library to making HTTP requests.
  2. pprint — PrettyPrinter:
pip install requests pprint

First, let’s sign up on the Goibibo’s API portal

Fill in the details and activate your account from the email received. You will now be able to access the API key and the Application ID, which will be used for making calls with the APIs.

First, let’s import the requests module

import requests
from pprint import PrettyPrinter
pp = PrettyPrinter()

Store the App ID and the API Key into variables for future use


The parameters required for fetching flights using the API

Let’s create a dictionary to store the values of these parameters

params = {

Let’s hit the API Url and fetch the result for the above parameters

URL = "http://developer.goibibo.com/api/search/"response = requests.get(URL,params=params).json()
Snip of the JSON Response (output) of the above code snippet

We can loop this code and try to find the best flight price for the given locations and then simply send an email reminder using the mail service which was discussed in Daily Python #1.

I hope this article was helpful, do leave some claps if you liked it.

Follow the Daily Python Challenge here:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store