Skip to main content

This is a lightweight library that works as a connector to Binance Pay public API

Project description

Binance Pay Public API Connector Python

Python 3.6 License: MIT

This is a lightweight library that works as a connector to Binance Pay public API

Installation

pip install binance-pay-connector

Documentation

https://binance-pay-connector.readthedocs.io

RESTful APIs

Usage examples:

from binance.pay.merchant import Merchant as Client


# Setup merchant API from https://merchant.binance.com/en/dashboard/developers

client = Client(key='<api_key>', secret='<api_secret>')
response = client.get_order(merchantTradeNo="<trade_no>")

# Get an order details
print(response)

Please find examples folder to check for more endpoints.

Optional parameters

PEP8 suggests lowercase with words separated by underscores, but for this connector, the methods' optional parameters should follow their exact naming as in the API documentation.

# Recognised parameter name
response = client.get_order(merchantTradeNo="2223")

# Unrecognised parameter name
response = client.get_order(merchant_trade_no="2223")

Display logs

Setting the log level to DEBUG will log the request URL, payload and response text.

Error

If a request has a parameter that is not provided but required from server, this library will throw an exception binance.pay.error.ParameterRequiredError, except the endpoint that is for creating order. POST /binancepay/openapi/v2/order that used to create order has complicate parameter strucuture, the library doesn't any mandatory parameter. Please see the example file for how to place an order.

Test Case

# In case packages are not installed yet
pip install -r requirements/requirements-test.txt

pytest

Contributing

Contributions are welcome.
If you've found a bug within this project, please open an issue to discuss what you would like to change.
If it's an issue with the API, please open a topic at Binance Developer Community

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

binance-pay-connector-0.0.1.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

binance_pay_connector-0.0.1-py3-none-any.whl (8.4 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