binDB
Credit: This library is a synchronous adaptation of the original smartbindb library which is asynchronous found at https://pypi.org/project/smartbindb/.
A Python library for retrieving BIN (Bank Identification Number) information.
Installation
You can install binDB using pip:
pip install binDB
Usage
from binDB import BinDB
db = BinDB()
# Get BIN information
bin_info = db.get_bin_info("45717360")
print(bin_info)
# Get BINs by bank name
bank_bins = db.get_bins_by_bank("JPMorgan Chase", limit=5)
print(bank_bins)
# Get BINs by country code
country_bins = db.get_bins_by_country("US", limit=5)
print(country_bins)
Available Methods (Endpoints)
The BinDB class provides the following methods for interacting with BIN data:
get_bin_info(bin: str) -> dict
Retrieves detailed information for a specific BIN.
bin: The 6-digit BIN to look up.
get_bins_by_bank(bank: str, limit: Optional[int] = None, fuzzy_match_threshold: int = 80) -> dict
Retrieves BINs associated with a specific bank name. Supports fuzzy matching.
bank: The name of the bank to search for.limit: (Optional) Maximum number of results to return.fuzzy_match_threshold: (Optional) Score threshold for fuzzy matching (default: 80).
get_bins_by_country(country: str, limit: Optional[int] = None, randomize: bool = False) -> dict
Retrieves BINs for a specific country.
country: The two-letter ISO country code (e.g., "US", "GB").limit: (Optional) Maximum number of results to return.randomize: (Optional) IfTrue, returns a random sample of BINs (default:False).
get_bins(country_code: Optional[str] = None, limit: int = 10, randomize: bool = False) -> dict
Retrieves a list of BINs, optionally filtered by country.
country_code: (Optional) The two-letter ISO country code. IfNone, retrieves BINs from all countries.limit: Maximum number of results to return (default: 10).randomize: IfTrue, returns a random sample of BINs (default:False).
get_all_bank_names(country_code: Optional[str] = None, count_bins: bool = False) -> List[Dict]
Retrieves a list of all unique bank names in the database, optionally filtered by country and with BIN counts.
country_code: (Optional) The two-letter ISO country code.count_bins: IfTrue, includes the count of BINs for each bank (default:False).
get_total_bins_count() -> int
Returns the total number of unique BINs loaded in the database.
get_country_bin_counts() -> dict
Returns a dictionary with country codes as keys and the number of BINs for each country as values, sorted by count in descending order.
Data
The library uses JSON files located in the data/ directory for BIN information.
Contributing
Feel free to contribute to this project by opening issues or pull requests on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
binDB
A Python library for retrieving BIN (Bank Identification Number) information.
Installation
You can install binDB using pip:
pip install binDB
Usage
from binDB.smartdb import SmartBinDB
db = SmartBinDB()
# Get BIN information
bin_info = db.get_bin_info("45717360")
print(bin_info)
# Get BINs by bank name
bank_bins = db.get_bins_by_bank("JPMorgan Chase", limit=5)
print(bank_bins)
# Get BINs by country code
country_bins = db.get_bins_by_country("US", limit=5)
print(country_bins)
Available Methods (Endpoints)
The SmartBinDB class provides the following methods for interacting with BIN data:
get_bin_info(bin: str) -> dict
Retrieves detailed information for a specific BIN.
bin: The 6-digit BIN to look up.
get_bins_by_bank(bank: str, limit: Optional[int] = None, fuzzy_match_threshold: int = 80) -> dict
Retrieves BINs associated with a specific bank name. Supports fuzzy matching.
bank: The name of the bank to search for.limit: (Optional) Maximum number of results to return.fuzzy_match_threshold: (Optional) Score threshold for fuzzy matching (default: 80).
get_bins_by_country(country: str, limit: Optional[int] = None, randomize: bool = False) -> dict
Retrieves BINs for a specific country.
country: The two-letter ISO country code (e.g., "US", "GB").limit: (Optional) Maximum number of results to return.randomize: (Optional) IfTrue, returns a random sample of BINs (default:False).
get_bins(country_code: Optional[str] = None, limit: int = 10, randomize: bool = False) -> dict
Retrieves a list of BINs, optionally filtered by country.
country_code: (Optional) The two-letter ISO country code. IfNone, retrieves BINs from all countries.limit: Maximum number of results to return (default: 10).randomize: IfTrue, returns a random sample of BINs (default:False).
get_all_bank_names(country_code: Optional[str] = None, count_bins: bool = False) -> List[Dict]
Retrieves a list of all unique bank names in the database, optionally filtered by country and with BIN counts.
country_code: (Optional) The two-letter ISO country code.count_bins: IfTrue, includes the count of BINs for each bank (default:False).
get_total_bins_count() -> int
Returns the total number of unique BINs loaded in the database.
get_country_bin_counts() -> dict
Returns a dictionary with country codes as keys and the number of BINs for each country as values, sorted by count in descending order.
Data
The library uses JSON files located in the data/ directory for BIN information.
Contributing
Feel free to contribute to this project by opening issues or pull requests on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for binDB 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bindb-0.1.8.tar.gz | 2.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bindb-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 MB
Release files / bindb-0.1.8.tar.gz
| Download URL | bindb-0.1.8.tar.gz |
|---|---|
| Size | 2.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6782e96d81781998b729dd7f5c89198b09bc8786e6fc8a7e4517edf09f2365cb
|
|
BLAKE2b-256 checksum How to use checksums |
f9a1148fc65821f0eeb33c24f4ff9eac58839b88abbdaf1850fc1d5840c89b8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / bindb-0.1.8-py3-none-any.whl
| Download URL | bindb-0.1.8-py3-none-any.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3fcac832f331318996c0f3229f24444e946a622dde3da89a62cad3edd5377f4
|
|
BLAKE2b-256 checksum How to use checksums |
6c90092282cc44d996b11a5b3af56cb42b80e86d12401faa536ea2ec4dbf428c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|