A powerful Asynchronous Python library for getting bins database by country name or bank name, also supports bin lookup, supporting bots, MTProto API frameworks, and Python scripts
Project description
SmartBinDB
A powerful asynchronous Python library for retrieving Bank Identification Number (BIN) database information, supporting lightning-fast lookups by country name, bank name, and individual BINs. Optimized for bots, MTProto API frameworks, and Python scripts, SmartBinDB is the ultimate solution for developers needing reliable and high-performance BIN data access. This is a closed-source project, and the source code is not available for public distribution.
Why SmartBinDB is the Best
- Lightning-Fast Performance: Utilizes a pre-built binary database (
smartbin.db) withpickleserialization for near-instantaneous data loading and O(1) BIN lookups, eliminating the overhead of parsing multiple JSON files. - Comprehensive BIN Coverage: Ensures no BINs are skipped, with robust indexing of all entries (e.g.,
515462for US,515452for Spain) from the binary database, guaranteeing 100% data fidelity. - Seamless Integration: Designed for easy integration with Telegram bots, MTProto API frameworks, and standalone Python scripts, with minimal dependencies for maximum compatibility.
- Optimized for Scalability: Supports high-throughput queries with efficient memory usage, ideal for large-scale applications and real-time bot responses.
- Robust Error Handling: Provides clear error messages for missing or corrupted database files, ensuring developers can quickly diagnose issues.
Features
- Asynchronous Operations: Built with
asynciofor non-blocking, high-performance data retrieval, perfect for real-time applications. - Flexible Lookups: Perform searches by country code (e.g.,
US,ES), bank name, or specific BIN number, with optional result limits for large datasets. - Comprehensive BIN Data: Returns detailed information including BIN, brand, type, issuer, country, and more, with proper country name and flag emoji support via
pycountry. - Binary Database Efficiency: Loads data exclusively from a single
smartbin.dbfile, pre-indexed for speed, eliminating the need for JSON file parsing. - US-Specific Handling: Aggregates data for
US,US1, andUS2country codes under a singleUSquery, with a maximum limit of 8000 results for scalability. - Minimal Dependencies: Requires only
pycountryandpycountry-convert, withpickleandasyncioprovided by the Python standard library. - Compatible with Python 3.8+: Works seamlessly across all modern Python versions, ensuring broad compatibility.
Installation
Install SmartBinDB via pip:
pip install smartbindb
Ensure the smartbin.db file is present in the smartbindb/data/ directory after installation. This pre-built binary database contains all BIN data and is required for operation.
Usage
Basic Asyncio Example
import asyncio
from smartbindb import SmartBinDB
async def main():
smartdb = SmartBinDB()
print("What would you like to do?")
print("1. BIN lookup")
print("2. Bank based search")
print("3. Country based search")
choice = input("Enter your choice (1, 2, or 3): ")
if choice == "1":
bin_number = input("Enter BIN number: ")
result = await smartdb.get_bin_info(bin_number)
print("BIN info:", result)
elif choice == "2":
bank_name = input("Enter bank name: ")
use_limit = input("Do you want to use a limit? (yes/no): ").lower()
limit = None
if use_limit == "yes":
limit = int(input("Enter limit: "))
result = await smartdb.get_bins_by_bank(bank_name, limit)
print("Bank results:", result)
elif choice == "3":
country_code = input("Enter country code: ").upper()
use_limit = input("Do you want to use a limit? (yes/no): ").lower()
limit = None
if use_limit == "yes":
limit = int(input("Enter limit: "))
result = await smartdb.get_bins_by_country(country_code, limit)
print("Country results:", result)
else:
print("Invalid choice. Please select 1, 2, or 3.")
if __name__ == "__main__":
asyncio.run(main())
Example Output
For a BIN lookup (515452):
Loaded from binary DB: 228 countries and 327013 BINs
What would you like to do?
1. BIN lookup
2. Bank based search
3. Country based search
Enter your choice (1, 2, or 3): 1
Enter BIN number: 515452
BIN info: {
'status': 'SUCCESS',
'data': [{
'bin': '515452',
'brand': 'MASTERCARD',
'category': 'PLATINUM',
'CardTier': 'PLATINUM MASTERCARD',
'country_code': 'ES',
'Type': 'DEBIT',
'country_code_alpha3': 'ESP',
'Country': {'A2': 'ES', 'A3': 'ESP', 'N3': '724', 'Name': 'Spain', 'Cont': 'Europe'},
'issuer': 'OPEN BANK, S.A.',
'phone': '',
'type': 'DEBIT',
'website': ''
}],
'count': 1,
'filtered_by': 'bin',
'api_owner': '@ISmartCoder',
'api_channel': '@TheSmartDev',
'Luhn': True
}
What's New in Version 4.16.8
- Binary Database Loading: Replaced JSON file parsing with a single
smartbin.dbbinary database, usingpicklefor ultra-fast data loading and minimal overhead. - No BIN Skips: Robust indexing ensures all BINs (e.g.,
515462for US,515452for Spain) are loaded correctly, fixing previous issues with missing entries. - Optimized Performance: Achieves "lightning fast" query times with in-memory
BIN_INDEXfor O(1) lookups and cached country data via@lru_cache. - Streamlined Dependencies: Reduced to
pycountryandpycountry-convert, leveraging Python’s standard library (pickle,asyncio) for simplicity and compatibility. - Enhanced Error Handling: Clear error messages for missing or corrupted
smartbin.db, improving developer experience.
Why It's So Fast
SmartBinDB 4.16.8 is optimized for speed through:
- Pre-Built Binary Database: The
smartbin.dbfile is pre-serialized usingpickle, allowing near-instantaneous deserialization into memory, bypassing the need to parse hundreds of JSON files. - In-Memory Indexing: Uses a
BIN_INDEXdictionary for O(1) BIN lookups, ensuring queries like/bin 515462or/bin 515452return results in milliseconds. - Cached Country Data: The
@lru_cachedecorator onget_country_infominimizes overhead for country name and flag lookups, critical for Telegram bot responses. - No File I/O Overhead: Eliminates runtime JSON file access, making it ideal for high-throughput applications like bots and APIs.
Contributing
This is a closed-source project, and contributions are not accepted at this time.
License
This project is proprietary and not licensed for open-source use.
Contact
- Author: @ISmartCoder
- Email: abirxdhackz.info.me@gmail.com
- GitHub: abirxdhack
- Documentation: SmartBinDB Docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smartbindb-4.12.8.tar.gz.
File metadata
- Download URL: smartbindb-4.12.8.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0352309f754f09385d7229f4cc92c889f5fc4ac4439f8aeb1a8fbb5bfd800d83
|
|
| MD5 |
a6c91e403d9e99596a498310eadaaf0c
|
|
| BLAKE2b-256 |
3bae10f15dc26581ccada7777d644dc6cfa90b016725c2e58da6e9d4d096f220
|
File details
Details for the file smartbindb-4.12.8-py3-none-any.whl.
File metadata
- Download URL: smartbindb-4.12.8-py3-none-any.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
120d9ea41c6947eb85d257c2ad99f165ef9c71dbb383299d37c91ca118e24658
|
|
| MD5 |
464807084b9e40ca61aade447883c7f5
|
|
| BLAKE2b-256 |
823b4477470ffe945707e5e163fb2ac327e4ffc86d9eaca24666ede99b6cc432
|