ucoinpy : A python implementation of uCoin API¶
ucoinpy is a library to develop an application for uCoin. ucoinpy helps to handle the following problem :
- Request Basic Merkle API provided by uCoin nodes
- Request nodes in a non-blocking way
- Handle uCoin signing keys
Library Installation¶
$ pip install ucoinpy
Getting Started¶
Client example:
import asyncio
import aiohttp
import ucoinpy
# Get the information /node/summary from the given node :
def getSummaryInfo():
# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT]
# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT]
myEndpoint = "BASIC_MERKLED_API metab.ucoin.io 9201"
# Here we request for the path /node/ "summary" through the "Basic Merkled API"
summaryInfo = yield from Summary(Endpoint.from_inline(myEndpoint).conn_handler()).get()
print(summaryInfo)
# Latest uCoin-Python-API is asynchronous and you have to use asyncio, an asyncio loop and a "yield from" on the data.
# ( https://docs.python.org/3/library/asyncio.html )
asyncio.get_event_loop().run_until_complete(getSummaryInfo())
Source code¶
Sources can be found at https://github.com/ucoin-io/ucoin-python-api
Contributions are welcome.