binance-sdk-nft


Namebinance-sdk-nft JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
SummaryOfficial Binance NFT SDK - A lightweight library that provides a convenient interface to Binance's NFT REST API
upload_time2025-08-22 14:53:35
maintainerNone
docs_urlNone
authorBinance
requires_python<3.14,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Binance Python NFT SDK

[![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci.yaml)](https://github.com/binance/binance-connector-python/actions)
[![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-python)](https://github.com/binance/binance-connector-python/issues)
[![Code Style: Black](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)
[![PyPI version](https://img.shields.io/pypi/v/binance-sdk-nft)](https://pypi.python.org/pypi/binance-sdk-nft)
[![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-nft.svg)](https://pypi.org/project/binance-sdk-nft/)
[![Python version](https://img.shields.io/pypi/pyversions/binance-sdk-nft)](https://www.python.org/downloads/)
[![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-python/security)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This is a client library for the Binance NFT SDK API, enabling developers to interact programmatically with Binance's NFT trading platform. The library provides tools to launch and trade NFTs through the REST API:

- [REST API](./src/binance_sdk_nft/rest_api/rest_api.py)

## Table of Contents

- [Supported Features](#supported-features)
- [Installation](#installation)
- [Documentation](#documentation)
- [REST APIs](#rest-apis)
- [Testing](#testing)
- [Migration Guide](#migration-guide)
- [Contributing](#contributing)
- [Licence](#licence)

## Supported Features

- REST API Endpoints:
  - `/sapi/v1/nft/*`
- Inclusion of test cases and examples for quick onboarding.

## Installation

To use this library, ensure your environment is running Python version **3.9** or later.

```bash
pip install binance-sdk-nft
```

## Documentation

For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/nft/Introduction).

### REST APIs

All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_nft/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.

```python
from binance_common.configuration import ConfigurationRestAPI
from binance_common.constants import NFT_REST_API_PROD_URL
from binance_sdk_nft.nft import NFT
from binance_sdk_nft.rest_api.models import GetNFTAssetResponse

logging.basicConfig(level=logging.INFO)
configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=NFT_REST_API_PROD_URL)

client = NFT(config_rest_api=configuration)

try:
    response = client.rest_api.get_nft_asset()

    data: GetNFTAssetResponse = response.data()
    logging.info(f"get_nft_asset() response: {data}")
except Exception as e:
    logging.error(f"get_nft_asset() error: {e}")
```

More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.

#### Configuration Options

The REST API supports the following advanced configuration options:

- `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
- `proxy`: Proxy configuration:
  - `host`: Proxy server hostname.
  - `port`: Proxy server port.
  - `protocol`: Proxy protocol (http or https).
  - `auth`: Proxy authentication credentials:
    - `username`: Proxy username.
    - `password`: Proxy password.
- `keep_alive`: Enable HTTP keep-alive (default: true).
- `compression`: Enable response compression (default: true).
- `retries`: Number of retry attempts for failed requests (default: 3).
- `backoff`: Delay in milliseconds between retries (default: 1000 ms).
- `https_agent`: Custom HTTPS agent for advanced TLS configuration.
- `private_key`: RSA or ED25519 private key for authentication.
- `private_key_passphrase`: Passphrase for the private key, if encrypted.

##### Timeout

You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest_api/timeout.md) for detailed usage.

##### Proxy

The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.

##### Keep-Alive

Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.

##### Compression

Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.

##### Retries

Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest_api/retries.md) for detailed usage.

##### HTTPS Agent

Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.

##### Key Pair Based Authentication

The REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest_api/key-pair-authentication.md) for detailed usage.

##### Certificate Pinning

To enhance security, you can use certificate pinning with the `https_agent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest_api/certificate-pinning.md) for detailed usage.

#### Error Handling

The REST API provides detailed error types to help you handle issues effectively:

- `ClientError`: Represents an error that occurred in the SDK client.
- `RequiredError`: Thrown when a required parameter is missing or undefined.
- `UnauthorizedError`: Indicates missing or invalid authentication credentials.
- `ForbiddenError`: Access to the requested resource is forbidden.
- `TooManyRequestsError`: Rate limit exceeded.
- `RateLimitBanError`: IP address banned for exceeding rate limits.
- `ServerError`: Internal server error, optionally includes a status code.
- `NetworkError`: Issues with network connectivity.
- `NotFoundError`: Resource not found.
- `BadRequestError`: Invalid request or one that cannot be served.

See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.

If `base_path` is not provided, it defaults to `https://api.binance.com`.

## Testing

To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:

```bash
poetry install
poetry run pytest ./tests
```

The tests cover:
* REST API endpoints
* Error handling
* Edge cases

## Migration Guide

If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_nft_sdk.md) for detailed steps.

## Contributing

Contributions are welcome!

Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes.

To contribute:

1. Open a GitHub issue describing your suggestion or the bug you've identified.
2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.

Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.

Thank you for your contributions!

## Licence

This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "binance-sdk-nft",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Binance",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/18/19/08cbe7bc893f296b8353176ddb14aa57495c1930a50d7bec53a3be11cb0c/binance_sdk_nft-1.3.0.tar.gz",
    "platform": null,
    "description": "# Binance Python NFT SDK\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci.yaml)](https://github.com/binance/binance-connector-python/actions)\n[![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-python)](https://github.com/binance/binance-connector-python/issues)\n[![Code Style: Black](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)\n[![PyPI version](https://img.shields.io/pypi/v/binance-sdk-nft)](https://pypi.python.org/pypi/binance-sdk-nft)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-nft.svg)](https://pypi.org/project/binance-sdk-nft/)\n[![Python version](https://img.shields.io/pypi/pyversions/binance-sdk-nft)](https://www.python.org/downloads/)\n[![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-python/security)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis is a client library for the Binance NFT SDK API, enabling developers to interact programmatically with Binance's NFT trading platform. The library provides tools to launch and trade NFTs through the REST API:\n\n- [REST API](./src/binance_sdk_nft/rest_api/rest_api.py)\n\n## Table of Contents\n\n- [Supported Features](#supported-features)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [REST APIs](#rest-apis)\n- [Testing](#testing)\n- [Migration Guide](#migration-guide)\n- [Contributing](#contributing)\n- [Licence](#licence)\n\n## Supported Features\n\n- REST API Endpoints:\n  - `/sapi/v1/nft/*`\n- Inclusion of test cases and examples for quick onboarding.\n\n## Installation\n\nTo use this library, ensure your environment is running Python version **3.9** or later.\n\n```bash\npip install binance-sdk-nft\n```\n\n## Documentation\n\nFor detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/nft/Introduction).\n\n### REST APIs\n\nAll REST API endpoints are available through the [`rest_api`](./src/binance_sdk_nft/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.\n\n```python\nfrom binance_common.configuration import ConfigurationRestAPI\nfrom binance_common.constants import NFT_REST_API_PROD_URL\nfrom binance_sdk_nft.nft import NFT\nfrom binance_sdk_nft.rest_api.models import GetNFTAssetResponse\n\nlogging.basicConfig(level=logging.INFO)\nconfiguration = ConfigurationRestAPI(api_key=\"your-api-key\", api_secret=\"your-api-secret\", base_path=NFT_REST_API_PROD_URL)\n\nclient = NFT(config_rest_api=configuration)\n\ntry:\n    response = client.rest_api.get_nft_asset()\n\n    data: GetNFTAssetResponse = response.data()\n    logging.info(f\"get_nft_asset() response: {data}\")\nexcept Exception as e:\n    logging.error(f\"get_nft_asset() error: {e}\")\n```\n\nMore examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.\n\n#### Configuration Options\n\nThe REST API supports the following advanced configuration options:\n\n- `timeout`: Timeout for requests in milliseconds (default: 1000 ms).\n- `proxy`: Proxy configuration:\n  - `host`: Proxy server hostname.\n  - `port`: Proxy server port.\n  - `protocol`: Proxy protocol (http or https).\n  - `auth`: Proxy authentication credentials:\n    - `username`: Proxy username.\n    - `password`: Proxy password.\n- `keep_alive`: Enable HTTP keep-alive (default: true).\n- `compression`: Enable response compression (default: true).\n- `retries`: Number of retry attempts for failed requests (default: 3).\n- `backoff`: Delay in milliseconds between retries (default: 1000 ms).\n- `https_agent`: Custom HTTPS agent for advanced TLS configuration.\n- `private_key`: RSA or ED25519 private key for authentication.\n- `private_key_passphrase`: Passphrase for the private key, if encrypted.\n\n##### Timeout\n\nYou can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest_api/timeout.md) for detailed usage.\n\n##### Proxy\n\nThe REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.\n\n##### Keep-Alive\n\nEnable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.\n\n##### Compression\n\nEnable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.\n\n##### Retries\n\nConfigure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest_api/retries.md) for detailed usage.\n\n##### HTTPS Agent\n\nCustomize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.\n\n##### Key Pair Based Authentication\n\nThe REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest_api/key-pair-authentication.md) for detailed usage.\n\n##### Certificate Pinning\n\nTo enhance security, you can use certificate pinning with the `https_agent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest_api/certificate-pinning.md) for detailed usage.\n\n#### Error Handling\n\nThe REST API provides detailed error types to help you handle issues effectively:\n\n- `ClientError`: Represents an error that occurred in the SDK client.\n- `RequiredError`: Thrown when a required parameter is missing or undefined.\n- `UnauthorizedError`: Indicates missing or invalid authentication credentials.\n- `ForbiddenError`: Access to the requested resource is forbidden.\n- `TooManyRequestsError`: Rate limit exceeded.\n- `RateLimitBanError`: IP address banned for exceeding rate limits.\n- `ServerError`: Internal server error, optionally includes a status code.\n- `NetworkError`: Issues with network connectivity.\n- `NotFoundError`: Resource not found.\n- `BadRequestError`: Invalid request or one that cannot be served.\n\nSee the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.\n\nIf `base_path` is not provided, it defaults to `https://api.binance.com`.\n\n## Testing\n\nTo run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:\n\n```bash\npoetry install\npoetry run pytest ./tests\n```\n\nThe tests cover:\n* REST API endpoints\n* Error handling\n* Edge cases\n\n## Migration Guide\n\nIf you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_nft_sdk.md) for detailed steps.\n\n## Contributing\n\nContributions are welcome!\n\nSince this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes.\n\nTo contribute:\n\n1. Open a GitHub issue describing your suggestion or the bug you've identified.\n2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.\n\nPlease ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.\n\nThank you for your contributions!\n\n## Licence\n\nThis project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Official Binance NFT SDK - A lightweight library that provides a convenient interface to Binance's NFT REST API",
    "version": "1.3.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "255c6ad20a47cf5810613d76ecb9fe43a78e7050bc8434e26b5a9f287daf537a",
                "md5": "ca13a2ee5e2138c45d9356036649ba3e",
                "sha256": "401f8460d12c5f765054bdd76f3d4106719a13e106d704d6f1a12510bcca17e5"
            },
            "downloads": -1,
            "filename": "binance_sdk_nft-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ca13a2ee5e2138c45d9356036649ba3e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.9",
            "size": 25425,
            "upload_time": "2025-08-22T14:53:34",
            "upload_time_iso_8601": "2025-08-22T14:53:34.946023Z",
            "url": "https://files.pythonhosted.org/packages/25/5c/6ad20a47cf5810613d76ecb9fe43a78e7050bc8434e26b5a9f287daf537a/binance_sdk_nft-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "181908cbe7bc893f296b8353176ddb14aa57495c1930a50d7bec53a3be11cb0c",
                "md5": "691c65672b6e20c46407f8bb6afef92e",
                "sha256": "84cf27e9c593683723189e4ec6d46643b894d3631abbb0e96c5e4536562ddcc6"
            },
            "downloads": -1,
            "filename": "binance_sdk_nft-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "691c65672b6e20c46407f8bb6afef92e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.9",
            "size": 13008,
            "upload_time": "2025-08-22T14:53:35",
            "upload_time_iso_8601": "2025-08-22T14:53:35.883907Z",
            "url": "https://files.pythonhosted.org/packages/18/19/08cbe7bc893f296b8353176ddb14aa57495c1930a50d7bec53a3be11cb0c/binance_sdk_nft-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-22 14:53:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "binance-sdk-nft"
}
        
Elapsed time: 1.11398s