https://github.com/div72/python-gridcoin
https://github.com/div72/python-gridcoin
gridcoin library python rpc-client
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/div72/python-gridcoin
- Owner: div72
- License: mit
- Created: 2023-08-05T18:36:45.000Z (almost 3 years ago)
- Default Branch: devel
- Last Pushed: 2023-08-08T15:24:15.000Z (almost 3 years ago)
- Last Synced: 2024-05-01T19:35:03.315Z (about 2 years ago)
- Topics: gridcoin, library, python, rpc-client
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-gridcoin
A python library for Gridcoin-related stuff. `python-gridcoin` is a [sans-IO library](https://sans-io.readthedocs.io/) so you'll have to bring your own networking library in order to use the networking related functions.
## Installation
```sh
pip install .
# Alternatively, in edit mode for development:
pip install -e .
```
## Quickstart
```python
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:
```python
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](LICENSE).