Open In App

Get Bank details from IFSC Code Using Python

Improve
Improve
Like Article
Like
Save
Share
Report

The Indian Financial System Code (IFSC) is an 11-digit alpha-numeric code used to uniquely classify bank branches within the National Electronic Fund Transfer (NEFT) network by the Central Bank.

In this article, we are going to write python scripts to get details of the Bank from the given IFSC code.

Methods 1:

Module Used:

ifscapi: The IfscApi Module will help to collect the details of the bank. The IFSC API was designed to easily get the specifics of the BANK from the IFSC code.

Installation:

pip install ifscApi

Step-by-step Approach:

  • Import module.
  • Parse the IFSC code into getdata() function (object of FetchData).
  • Above step returns a dictionary approach along with timeto fetch the details.
  • Display bank details

Below is complete program of the above approach:

Python3




# Import required module
from ifscApi.getDetails import FetchData
  
# Assign IFSC code
ifsc = 'KKBK0005652'
  
# Parse the ifsc code
data = FetchData().getdata(ifsc)
  
# Display details
print(data)


Output:

Note: The dbFilePath parameter of getdata() function can be overwritten with IFSC code Database which has a table named data and consists of three columns Ifsc, bank, address.

Methods 2:

In this method, we are going to use Razorpay IFSC Toolkit to fetch IFSC code. 

Modules:

requests: This module allows you to send HTTP/1.1 requests extremely easily. The get() method of this module is used to get bank details from IFSC code.

Installation:

pip install requests

Below is working of Razorpay IFSC Toolkit to fetch bank details from IFSC code.

Step-by-step Approach:

  • Import module.
  • Pass URL and IFSC code into requests.get() function.
  • Fetch this JSON response.
  • And it returns bank details in a Dict data-type.

Below is complete program of the above approach:

Python3




# Import required modules
import requests
  
# Assign IFSC code and URL
IFSC_Code = 'KKBK0005652'
  
# Use get() method
data = requests.get(URL+IFSC_Code).json()
  
# Display bank details
print(data)


Output:



Last Updated : 11 Oct, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads