This is a lightweight library that works as a connector to Binance Pay public API
Project description
Binance Pay Public API Connector Python
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
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
File details
Details for the file binance-pay-connector-1.0.0.tar.gz
.
File metadata
- Download URL: binance-pay-connector-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a91399903825e382c0a4f0a2c0ca65cd97a870d85b359de988979e2f5f0b7a3 |
|
MD5 | cd7a4b0be49c92321270a90b8dba1d0b |
|
BLAKE2b-256 | 436376e991ad7e17467b13fa9ff84770116a178efaa9d6ef90f75a5a58e0a678 |
File details
Details for the file binance_pay_connector-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: binance_pay_connector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee7a233dec0bbf20afbad46e1277c31e8cab8eb6ef4a9830712e8b4e0bdfec60 |
|
MD5 | 235ff9b5d69d185fcbdf3f94fcc6d2a1 |
|
BLAKE2b-256 | 42f35eaa9f90ac02f786d1ee901519ce712876ba680d7be5270ecdeecca6a231 |