kaspy
Python implementation of a kaspa-grpc client.
work in progress...
Breaking changes will occur without prior notice!
Installaton:
pip install kaspy
Basic Documentaion:
Connecting to a RPC server with connect() or auto_connect():
# Import the kaspa client
from kaspy.kaspa_clients import RPCClient
#Initialize a client instance
client = RPCClient()
#Connect to a predefined host
client.connect(host='<ip>', port='<port>')
#OR
#Connect to a a publicaly broadcasted node from the dns_seed_servers.
client.auto_connect()
#note:
# 1) it may take a while to find a responsive nodes, timeout should be issued to not get stuck searching
# 2) min node requirements for auto-connect is v0.12.2
Sending a request():
continued...
#define the command you want to send
command = 'getInfoRequest'
#build the payload for the command
payload = {} #in our case we don't need to send additional information
#send the request to the server and retrive the response
resp = client.request(command=command, payload=payload)
print(resp) # print response
Subscribing to a stream with subscribe():
continued...
command = 'notifyVirtualSelectedParentChainChangedRequest'
payload = {}
def callback_func(notification : dict) # create a callback function to process the notifications
print(notification)
#send the request to the server and retrive the response
resp = client.subscribe(command=command, payload=payload, callback=callback_func)
import time
time.sleep(5) # do stuff
client.unsubscribe(command) #unsubscribe to the stream
Disenganging the service with close() or disconnect()
continued...
client.disconnect() # finishes sending all requests and responses in Que, halts all operations, but keeps the channel open.
client.close() # closes the channel completely
for more references on commands and payloads see:
for conversions to KaspaMessage command names reference:
https://github.com/kaspagang/kaspy/blob/master/kaspy/protos/messages.proto
known issues:
GLIBC_2.33' not found: https://github.com/kaspagang/kaspy/issues/4 [Workaround]
To Do:
Fix breaking issue
Clean up, lots of unused code left in place.
Implement error handling and timeouts
Implement Streaming Callback handling of notification messages
add to pip
Implement auto-reconnect options to client
- Implement P2P communication
- 2nd cleanup
- Documentation
- Allow for commandline use
- ...
- Async Implementation
Requirements
- grpc
Contribute
feel free to open a pull request.
Authors
Donations welcome @ kaspa:qzyjckdvgyxgwqj8zztw7qkqylsp864fyquzg8ykmmwkz58snu85zlk0mfy89
Metadata
Release files for kaspy 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kaspy-0.0.13.tar.gz | 42.4 kB | Without provenance | Details for kaspy-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kaspy-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for kaspy-0.0.13-py3-none-any.whl |
Total release size: 87.6 kB
Release files / kaspy-0.0.13.tar.gz
| Download URL | kaspy-0.0.13.tar.gz |
|---|---|
| Size | 42.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88a893ce333d2e7402cf5ddb60e8eaafdc2bc31358e28da03e9925fca07923ec
|
|
BLAKE2b-256 checksum How to use checksums |
b71b35ec0db44c935d6744494ef6672ab89b385b0beea5a6795cc6204c66e8fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.6
|
Release files / kaspy-0.0.13-py3-none-any.whl
| Download URL | kaspy-0.0.13-py3-none-any.whl |
|---|---|
| Size | 45.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c97b13019ecb8fc6864a8c743ddf9496781a9eff09efa1c71471be67c22d9e04
|
|
BLAKE2b-256 checksum How to use checksums |
fb5a500498037bf15d00fad1a4e54f8e04537d3fcfbf780a0abca407f10e9227
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.6
|
Security for kaspy 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.