Skip to content

div72/python-gridcoin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-gridcoin

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.

Installation

pip install .

# Alternatively, in edit mode for development:

pip install -e .

Quickstart

import httpx # or requests
from gridcoin.rpc import WalletRPC

# 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:

import asyncio

import aiohttp
from gridcoin.rpc import WalletRPC


async def main():
    async with aiohttp.ClientSession() as client_session:
        rpc = WalletRPC(client_session.post)
        print(await rpc.getblockcount())


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

License

python-gridcoin is under the MIT License.

Releases

No releases published