Skip to main content

Python wrapper for Prompt API's BIN Checker API

Project description

Python Version Code style: black Build Status

Prompt API - BIN Checker - Python Package

pa-bin-checker is a simple python wrapper for bincheck-api.

Requirements

  1. You need to signup for Prompt API
  2. You need to subscribe bincheck-api, test drive is free!!!
  3. You need to set PROMPTAPI_TOKEN environment variable after subscription.

then;

$ pip install pa-bin-checker

Example Usage

from bin_checker import get_bin

bin_information = get_bin('302596')  # example BIN
if bin_information.get('error', False):
    print(bin_information['bank_name'])  # you have a dict!

You’ll have a dict of data:

{
    'bank_name': 'Diners Club International',
    'country': 'United States Of America',
    'url': 'www.dinersclub.com',
    'type': 'Credit',
    'scheme': 'Discover',
    'bin': '302596',
}

If you receive an error, payload will contain error key. Example error response:

{
    'error': 'You need to set PROMPTAPI_TOKEN environment variable',
}

Development

Create your virtual environment, then use rake tasks:

$ rake -T

rake build           # Build package
rake bump[revision]  # Bump version
rake clean           # Remove/Delete build..
rake default         # Default task => :install
rake install         # Install package for local development purpose
rake test            # Run test
rake upload:main     # Upload package to main distro (release)
rake upload:test     # Upload package to test distro

You need ruby to run rake tasks. Rake tasks are just helper functions for automation. You don’t need to install anything to proceed. If you are on macOS, you’ll already have ruby installed.

If you are on Ubuntu:

# install ruby on Ubuntu
$ sudo apt-get update -y
$ sudo apt-get install -y ruby-full

You need bumpversion to manage package versioning. If you are on macOS:

$ brew install bumpversion

If you are on Ubuntu:

# install bumpversion on Ubuntu
$ sudo apt-get update -y
$ sudo apt-get -y bumpversion

To install and test package locally, just call rake or rake install. Tests are available under tests/ folder. Run rake test to run tests.

To continue without ruby or rake:

  • Install package locally: pip install -e .[development]
  • Build package: python setup.py sdist bdist_wheel
  • Install bumpversion: pip install bumpversion

For uploading package to pypi registry you need to install:

$ pip install -U wheel setuptools

You need to put pypi credentials to ~/.pypirc:

[distutils]
index-servers=
    pypi-promptapi
    testpypi-promptapi

[pypi-promptapi]
repository = https://upload.pypi.org/legacy/
username: __token__
password: TOKEN

[testpypi-promptapi]
repository: https://test.pypi.org/legacy/
username: __token__
password: TOKEN
  • Upload to main registry: twine upload --repository pypi-promptapi dist/*
  • Upload to test repository: twine upload --repository testpypi-promptapi dist/*

License

This project is licensed under MIT


Contributer(s)


Contribute

All PR’s are welcome!

  1. fork (https://github.com/promptapi/bin-checker-py/fork)
  2. Create your branch (git checkout -b my-feature)
  3. commit yours (git commit -am 'Add awesome features...')
  4. push your branch (git push origin my-feature)
  5. Than create a new Pull Request!

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.


Project details


Download files

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

Source Distribution

pa-bin-checker-0.1.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

pa_bin_checker-0.1.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

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