Skip to main content

Toncenter API Python3 async wrap.

Project description

toncenter

Toncenter API Python3 async wrap.

Installation

pip3 install toncenter

Documentation (WIP)

https://witer33.github.io/toncenter/

Example

from toncenter.client import Client
import asyncio


async def main():
    
    async with Client(open("main_api_token.txt").read()) as client:
        info = await client.get_masterchain_info() # Gets masterchain info
        print(info.last) # Prints last block


if __name__ == "__main__":
    asyncio.run(main())

Example without context manager

from toncenter.client import Client
import asyncio


async def main():
    
    client = Client(open("main_api_token.txt").read())
    await client.start()
    
    info = await client.get_masterchain_info() # Gets masterchain info
    print(info.last) # Prints last block
    
    await client.stop() # ALWAYS call this method.


if __name__ == "__main__":
    asyncio.run(main())

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

toncenter-0.0.5.tar.gz (20.0 kB view hashes)

Uploaded Source

Built Distribution

toncenter-0.0.5-py3-none-any.whl (20.3 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