Skip to main content

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

  1. Import the Library: Import the necessary classes from the library.
from binlist import BIN_Lookup, RateLimitExceededError, BINLookupError
  1. Create a BIN Lookup Instance: Initialize the BIN_Lookup class with the desired BIN.
api = BIN_Lookup()
  1. Fetch BIN Information: Use the fetch method to retrieve information for a specific BIN. The proxy parameter 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

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybinlist-1.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybinlist-1.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

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

Hashes for pybinlist-1.0.tar.gz
Algorithm Hash digest
SHA256 d1117ab679bee4d86997618c4830df493aca79445f55c00b51882c2dc60318b7
MD5 6b1b9bd9c0c9f09d294ed92d02eb1706
BLAKE2b-256 79010575e806c21ae6a18924c8bc585c09f39cd552ed039db60c6850095c8836

See more details on using hashes here.

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

Hashes for pybinlist-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f99586c14d9bbdf7fdd78d96ea68a40e93f8af92d3b27af057dc9578750295d
MD5 b8a4d413e964324f35cfbb17f1a4e8f5
BLAKE2b-256 f4466a5902740fbaa1a167e0b5cd52dbc99b7c88c21fb7e35bcbe4b40cd5f011

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page