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 details)

Uploaded Source

Built Distribution

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

binance_pay_connector-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file binance-pay-connector-0.0.1.tar.gz.

File metadata

  • Download URL: binance-pay-connector-0.0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

File hashes

Hashes for binance-pay-connector-0.0.1.tar.gz
Algorithm Hash digest
SHA256 676a95f8e2276d6d54fb82a6baa95931483a332b318c831bd44f1dd4445f4d30
MD5 37ee18b8f7ccbb129409229fe809cd50
BLAKE2b-256 27a3936074b30167422eb8faadfb9e6dac91152a94d7454ba2bc3d927895806d

See more details on using hashes here.

File details

Details for the file binance_pay_connector-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: binance_pay_connector-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

File hashes

Hashes for binance_pay_connector-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57de77a51c71d980c07a4bcd1e81b2b49e06dbed9167deb70b80ff60844e61a1
MD5 24bd7f0ade16be356782a18fbb6a5435
BLAKE2b-256 9e0fb2e3fad88def13407e03d4b437eeabf52499b788692748f68bf828793e27

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