A python library for Gridcoin-related stuff. python-gridcoin is a sans-IO library so you'll have to bring your own networking library in order to use the networking related functions.
pip install .# Alternatively, in edit mode for development:
pip install -e .importhttpx# or requestsfromgridcoin.rpcimportWalletRPC# Connect to the mainnet client automatically:rpc=WalletRPC(httpx.post)
# Testnet:rpc=WalletRPC(httpx.post, testnet)
# You can also provide your own URL to connect:rpc=WalletRPC(httpx.post, url="http://user:password@localhost:15715")
print(rpc.help())Async IO is also supported:
importasyncioimportaiohttpfromgridcoin.rpcimportWalletRPCasyncdefmain():
asyncwithaiohttp.ClientSession() asclient_session:
rpc=WalletRPC(client_session.post)
print(awaitrpc.getblockcount())
if__name__=="__main__":
asyncio.run(main())python-gridcoin is under the MIT License.