IFSC validator is a python library that validates IFSC bank codes by making use of razorpay API.
- Make sure you have python3 installed in your system
- Clone the repository and cd into
ifsc
git clone https://github.com/rahulkaliyath/ifsc.git cd ifsc
-
pip install -r requirements.txt
- Install the library by running
pip install .
- Verify Installation by running the following in terminal
pip freeze | grep ifsc
Output
ifsc-validator==1.0.0
To import the IFSC module from any directory, save the ifsc
directory path in PYTHONPATH
Environment Variable.
- Open Terminal
-
echo "export PYTHONPATH= $PYTHONPATH:<Absolute-file-path-of-ifsc-directory>" >> ~/.bash_profile
- Open Git Bash Terminal
-
export PYTHONPATH="$PYTHONPATH:<Absolute-file-path-of-ifsc-directory>"
**Note: The above command will only work on one shell and the PATH is cleared when shell is closed **
To make the PYTHONPATH persistent, do the following steps
- Right Click on
This PC
and selectproperties
- Click on
Advanced System Settings
- Under
Advanced
tab, click onEnvironment Variables...
button - Select
new
in theuser variable
section - Give
Variable Name
asPYTHONPATH
andifsc
absolute path asVariable Value
Once the package is installed, the library can be accessed through CLI or by importing in other modules.
ifsc-cli
is the command to access the library.
-ifsc
, -i
: To validate and get information on an IFSC
code
-bank
, -b
: To validate and get information on a BANK
code
-city
, -c
: Used along with -bank
to get list of given bank in given city
--validate
, -v
: To validate an IFSC
code or a BANK
code
--get
, -g
: To get information of an IFSC
code or a BANK
code
--head
, -H
: List only top n
results
--help
, -h
: To view all the options and usage of each option
ifsc-cli -ifsc HDFC0CAACOB --validate
True
ifsc-cli -ifsc HDFC0CAACOB --get
+--------------------------------------------------------+
| Bank Details |
+----------+---------------------------------------------+
| Name | Values |
+----------+---------------------------------------------+
| BRANCH | Akhand Anand Co.op Bank IMPS |
| CENTRE | SURAT |
| DISTRICT | SURAT |
| STATE | GUJARAT |
| ADDRESS | NEAR ANATH BALASHRAM, KATARGAM SURAT.395004 |
| CONTACT | 2536772 |
| IMPS | True |
| CITY | SURAT |
| UPI | True |
| MICR | 395002437 |
| RTGS | True |
| NEFT | True |
| SWIFT | HDFCINBB |
| BANK | Akhand Anand Co.op Bank |
| BANKCODE | AACX |
| IFSC | HDFC0CAACOB |
+----------+---------------------------------------------+
ifsc-cli -bank HDFC --validate
True
ifsc-cli -bank HDFC --get
+--------------------------+
| Bank Details |
+------------+-------------+
| Name | Values |
+------------+-------------+
| code | HDFC |
| type | Private |
| ifsc | HDFC0999999 |
| micr | 400240001 |
| iin | 607152 |
| apbs | True |
| ach_credit | True |
| ach_debit | True |
| nach_debit | True |
| upi | True |
| name | HDFC Bank |
+------------+-------------+
ifsc-cli -city bangalore -bank HDFC --head 2
+------------------------------------------------------------------------------------------------------------+
| Bank Details |
+-----------+-------------+----------------------------------------------------------------------------------+
| Bank Name | IFSC | Address |
+-----------+-------------+----------------------------------------------------------------------------------+
| HDFC BANK | HDFC0000009 | 24/3 HDFC HOUSE,NO. 51 KASTURBA ROAD,BANGALOREKARNATAKA560 001 |
| HDFC BANK | HDFC0000041 | NO.47, MARGOSA ROAD,NEXT TO BSNL OFFICE, 15TH CROSS,MALLESHWARAM, BANGALORE,KAR |
+-----------+-------------+----------------------------------------------------------------------------------+
The test cases are written in test/test_ifsc.py
.CD into ifsc
root directory and Run the following to test the library
pytest .