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
from ifscApi.getDetails import FetchData
ifsc = 'KKBK0005652'
data = FetchData().getdata(ifsc)
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 requests
IFSC_Code = 'KKBK0005652'
data = requests.get(URL + IFSC_Code).json()
print (data)
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...