Related Articles

Related Articles

Get Bank details from IFSC Code Using Python
  • Last Updated : 11 Oct, 2020

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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:


Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :