Python wrapper for the StreamrProxyClient
This is a Python wrapper for the StreamrProxyClient C++ library. It is used to publish data to the Streamr network.
Installation
python -m pip install libstreamrproxyclient
The package is distributed as a binary wheel and is available for MacOS (arm64 and x86_64) and Linux (arm64 and x86_64).
Usage example
from streamrproxyclient.libstreamrproxyclient import (
Proxy,
LibStreamrProxyClient,
ProxyClient
)
proxy_ethereum_address = "0xd0d14b38d1f6b59d3772a63d84ece0a79e6e1c1f"
proxy_url = "ws://95.216.15.80:44211"
stream_part_id = "0xd2078dc2d780029473a39ce873fc182587be69db/low-level-client#0"
own_ethereum_address = "0xa5374e3c19f15e1847881979dd0c6c9ffe846bd5"
ethereum_private_key = "23bead9b499af21c4c16e4511b3b6b08c3e22e76e0591f5ab5ba8d4c3a5b1820"
with LibStreamrProxyClient() as lib:
with ProxyClient(lib, own_ethereum_address, stream_part_id) as client:
result = client.connect([Proxy(proxy_url, proxy_ethereum_address)])
assert len(result.errors) == 0
assert len(result.successful) == 1
result = client.publish(b"Hello from python!", ethereum_private_key)
assert len(result.errors) == 0
assert len(result.successful) == 1
API documentation
Classes
Proxy
Contains information about a proxy node in the Streamr network.
Methods:
__init__(websocket_url: str, ethereum_address: str): Initialize a Proxy instance with websocket URL and Ethereum addressfrom_c_proxy(c_proxy): Create Proxy instance from C struct (internal use)
Error
Represents an error from the C library.
Attributes:
message: Error message stringcode: Error code stringproxy: Associated Proxy instance if applicable
ProxyClientException
Exception raised when C library operations fail.
Attributes:
error: The Error instance containing details
ProxyClientResult
Result of proxy client operations.
Attributes:
errors: List of Error instances if operation had errorssuccessful: List of successful Proxy instances
LibStreamrProxyClient
Wrapper for the C library. Use as context manager.
Methods:
__enter__(): Load and initialize C library__exit__(): Cleanup C library
ProxyClient
Main client for interacting with proxies. Use as context manager.
Methods:
__init__(lib: LibStreamrProxyClient, ownEthereumAddress: str, streamPartId: str): Initialize with library instance, Ethereum address and stream IDconnect(proxies: list[Proxy]) -> ProxyClientResult: Connect to list of proxiespublish(data: bytes, ethereumPrivateKey: str = None) -> ProxyClientResult: Publish data to connected proxies
Error Codes
ERROR_INVALID_ETHEREUM_ADDRESS: Invalid Ethereum address formatERROR_INVALID_STREAM_PART_ID: Invalid stream part ID formatERROR_PROXY_CLIENT_NOT_FOUND: Proxy client instance not foundERROR_INVALID_PROXY_URL: Invalid proxy websocket URLERROR_NO_PROXIES_DEFINED: No proxies providedERROR_PROXY_CONNECTION_FAILED: Failed to connect to proxyERROR_PROXY_BROADCAST_FAILED: Failed to broadcast message to proxy
Metadata
Release files for libstreamrproxyclient 2.0.5
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 |
|---|---|---|---|---|
| libstreamrproxyclient-2.0.5.tar.gz | 4.9 kB | Without provenance | Details for libstreamrproxyclient-2.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl | Python 3 | none | macosx 13 6 arm64 | Details for libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl |
Total release size: 10.0 kB
Release files / libstreamrproxyclient-2.0.5.tar.gz
| Download URL | libstreamrproxyclient-2.0.5.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71a6b06b1f8350c1c9a8b95876910756b3480f263f3a30901ced2965b202dd2b
|
|
BLAKE2b-256 checksum How to use checksums |
f7a17beabf63651e7689e1b0f7028c02fd1694d35f37ab7333b259943fc56484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.2
|
Release files / libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl
| Download URL | libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 macosx 13 6 arm64 |
|
SHA-256 checksum How to use checksums |
fa68e7dd55aa30b4e5a3d5731893f7ff26e662a04dfe613fcce0f463e1437630
|
|
BLAKE2b-256 checksum How to use checksums |
754cdb591f23da2f67a8ad30dcaeec3a299ac344747674de4609ffede465ee34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.2
|
Security for libstreamrproxyclient 2.0.5
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.