Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

PyPi Package Version Supported Python versions PyPi downloads

pyTONPublicAPI

Python implementation of TON Public API for The Open Network (TON).

Supported API servers

Installation

Installation using pip (a Python package manager):

$ pip install pyTONPublicAPI

Usage

Everything is as simple as the API itself.

  1. Create pyTONPublicAPI instance
  2. Access API methods in pythonic notation (getAddressInformation -> get_address_information)
from pyTONPublicAPI import pyTONPublicAPI
client = pyTONPublicAPI()
print(client.get_address_balance(address = "EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N"))

If you want to work with a single address - you can pre-set it on init and avoid in functions.

from pyTONPublicAPI import pyTONPublicAPI
client = pyTONPublicAPI(address = "EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N")
print(client.get_address_balance())
print(client.get_transactions())

You can also check tests.py.

Exceptions

Exceptions are rised using pyTONException class.

API servers

By default all calls are sent to TON.sh server. To select API server you should:

  1. Create server object
  2. Pass it to pyTONPublicAPI constructor via api_server parameter
from pyTONPublicAPI import pyTONPublicAPI, pyTONAPIServerTonCenter
api_server=pyTONAPIServerTonCenter()
client = pyTONPublicAPI(api_server=api_server)

Ton.sh

Class

  • pyTONAPIServerTonSh

Additional constructor paramters:

  • blockchain_id - Identifier of target blockchain ID, either "mainnet" or "test". Default is "None", so default begaviour is up to API server.

Ton Center

Class

  • pyTONAPIServerTonCenter

Additional constructor paramters:

  • api_key - Authentication key. Using API without API key is limited to 1 request per second. Default is "None", so API is used without API key.

Ton Center Testnet

Class

  • pyTONAPIServerTonCenterTest

Additional constructor paramters:

  • api_key - Authentication key. Using API without API key is limited to 1 request per second. Default is "None", so API is used without API key.

TON API

Class

  • pyTONAPIServerTonAPI

Additional constructor paramters:

  • api_key - Authentication key. Using API without API key is limited to 1 request per second. Default is "None", so API is used without API key.

TON API Testnet

Class

  • pyTONAPIServerTonAPITest

Additional constructor paramters:

  • api_key - Authentication key. Using API without API key is limited to 1 request per second. Default is "None", so API is used without API key.

Notes

  1. API servers support different subset of commands. Check correspondent API specification before use.
  2. API servers have different reply formats! Currently it's up to you to deal with it. May be once there will be a reply parser for unification.

Metadata

Release files for pyTONPublicAPI 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyTONPublicAPI 0.2.1
File Size Uploaded Provenance Actions
pyTONPublicAPI-0.2.1.tar.gz 9.1 kB Without provenance Details for pyTONPublicAPI-0.2.1.tar.gz

Release files / pyTONPublicAPI-0.2.1.tar.gz

Download URL pyTONPublicAPI-0.2.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
797806f61747e354465ca286b0101289b67c4759e5039df9e981207b72c269ab
BLAKE2b-256 checksum
How to use checksums
17bab2cd6a60e85561a98700b3b29042196022d23a01e1bfa969dedf60c0cd51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for pyTONPublicAPI 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page