This release is a pre-release and may not be stable for production use.
XRPL Websocket
Websocket client for rippled with reconnecting feature, support both python 2 and 3
Installation
Via pip:
pip install xrpl_websocket
Examples
Short-lived connection
Simple example to send a payload and wait for response
import json
from xrpl_websocket import Client
if __name__ == "__main__":
# create instance
client = Client()
# connect to the websocket
client.connect(nowait=False)
# send server info command
resp = client.send(command='server_info')
print("Server Info:")
print(json.dumps(resp, indent = 4))
# close the connection
client.disconnect()
More advanced: Custom class
You can also write your own class for the connection, if you want to handle the nitty-gritty details yourself.
class Example(Client):
def __init__(self):
super(self.__class__, self).__init__(
log_level=logging.ERROR,
server="wss://xrpl.ws"
)
# connect to the websocket
self.connect()
def on_transaction(self, data):
print(json.dumps(data, indent = 4))
def on_ledger(self,data):
print('on_ledger')
def on_open(self, connection):
print("Connection is open")
print("Subscribe to ledger transactions")
self.subscribe_transactions()
def on_close(self):
print("on_close")
def subscribe_transactions(self):
self.send({
'command': 'subscribe',
'streams': ['transactions']
})
Metadata
Release files for xrpl-websocket 0.1.0rc3
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 |
|---|---|---|---|---|
| xrpl_websocket-0.1.0rc3.tar.gz | 11.5 kB | Without provenance | Details for xrpl_websocket-0.1.0rc3.tar.gz |
Release files / xrpl_websocket-0.1.0rc3.tar.gz
| Download URL | xrpl_websocket-0.1.0rc3.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2672b7d855e34ce448a053fa63ba709637b4fe0c5ecde22fcbbe5b58a9b18d8
|
|
BLAKE2b-256 checksum How to use checksums |
7dba36aef5470332d50475449f8f901c85476922707f87fb7086f19f77ba2595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Security for xrpl-websocket 0.1.0rc3
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.