A Python Wrapper for BIN lookup using the Binlist API
Project description
Binlist Python Library
A Python Wrapper for BIN lookup using the Binlist API.
Installation
You can install the package using pip:
pip install pybinlist
Features
- Retrieve BIN information such as scheme, type, brand, prepaid status, country details, and bank name.
- Support for proxy requests to bypass restrictions (optional).
- Custom exception handling for better error management.
Usage
Here’s how to use the Binlist Python library in your projects:
Basic Usage
- Import the Library: Import the necessary classes from the library.
from binlist import BIN_Lookup, RateLimitExceededError, BINLookupError
- Create a BIN Lookup Instance: Initialize the
BIN_Lookupclass with the desired BIN.
api = BIN_Lookup()
- Fetch BIN Information: Use the
fetchmethod to retrieve information for a specific BIN. Theproxyparameter is optional but can help bypass rate limits.
try:
info = api.fetch(bin='531462', proxy='http://your-proxy:port/') # Proxy is optional
print(f"Country: {info.country.name}, Bank: {info.bank.name}")
except (RateLimitExceededError, BINLookupError) as e:
print(e)
Handling Exceptions
The library provides custom exceptions to handle errors gracefully.
try:
info = api.fetch(bin='531462')
except RateLimitExceededError as e:
print(f"Error: {e.message}")
except BINLookupError as e:
print(f"Error: {e.message}")
Fetching Raw JSON Response
If you prefer to get the raw JSON response, you can use the fetch_json method:
try:
raw_data = api.fetch_json(bin='531462')
print(raw_data)
except (RateLimitExceededError, BINLookupError) as e:
print(e)
Contributing
Contributions are welcome! If you have suggestions or improvements, feel free to submit a pull request.
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 pybinlist-1.0.tar.gz.
File metadata
- Download URL: pybinlist-1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1117ab679bee4d86997618c4830df493aca79445f55c00b51882c2dc60318b7
|
|
| MD5 |
6b1b9bd9c0c9f09d294ed92d02eb1706
|
|
| BLAKE2b-256 |
79010575e806c21ae6a18924c8bc585c09f39cd552ed039db60c6850095c8836
|
File details
Details for the file pybinlist-1.0-py3-none-any.whl.
File metadata
- Download URL: pybinlist-1.0-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f99586c14d9bbdf7fdd78d96ea68a40e93f8af92d3b27af057dc9578750295d
|
|
| MD5 |
b8a4d413e964324f35cfbb17f1a4e8f5
|
|
| BLAKE2b-256 |
f4466a5902740fbaa1a167e0b5cd52dbc99b7c88c21fb7e35bcbe4b40cd5f011
|