libstreamrproxyclient


Namelibstreamrproxyclient JSON
Version 2.0.5 PyPI version JSON
download
home_pageNone
SummaryPython bindings for libstreamrproxyclient
upload_time2024-12-19 07:08:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords client proxy streamr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```bash
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

```python
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 address
- `from_c_proxy(c_proxy)`: Create Proxy instance from C struct (internal use)

#### Error
Represents an error from the C library.

Attributes:
- `message`: Error message string
- `code`: Error code string 
- `proxy`: 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 errors
- `successful`: 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 ID
- `connect(proxies: list[Proxy]) -> ProxyClientResult`: Connect to list of proxies
- `publish(data: bytes, ethereumPrivateKey: str = None) -> ProxyClientResult`: Publish data to connected proxies

### Error Codes

- `ERROR_INVALID_ETHEREUM_ADDRESS`: Invalid Ethereum address format
- `ERROR_INVALID_STREAM_PART_ID`: Invalid stream part ID format  
- `ERROR_PROXY_CLIENT_NOT_FOUND`: Proxy client instance not found
- `ERROR_INVALID_PROXY_URL`: Invalid proxy websocket URL
- `ERROR_NO_PROXIES_DEFINED`: No proxies provided
- `ERROR_PROXY_CONNECTION_FAILED`: Failed to connect to proxy
- `ERROR_PROXY_BROADCAST_FAILED`: Failed to broadcast message to proxy


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "libstreamrproxyclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Petri Savolainen <petri.savolainen@streamr.network>",
    "keywords": "client, proxy, streamr",
    "author": null,
    "author_email": "Petri Savolainen <petri.savolainen@streamr.network>",
    "download_url": "https://files.pythonhosted.org/packages/f7/a1/7beabf63651e7689e1b0f7028c02fd1694d35f37ab7333b259943fc56484/libstreamrproxyclient-2.0.5.tar.gz",
    "platform": null,
    "description": "# Python wrapper for the StreamrProxyClient\n\nThis is a Python wrapper for the StreamrProxyClient C++ library. It is used to publish data to the Streamr network.\n\n## Installation\n\n```bash\npython -m pip install libstreamrproxyclient\n```\nThe package is distributed as a binary wheel and is available for MacOS (arm64 and x86_64) and Linux (arm64 and x86_64).\n\n## Usage example\n\n```python\nfrom streamrproxyclient.libstreamrproxyclient import (\n    Proxy,\n    LibStreamrProxyClient,\n    ProxyClient\n)\n\nproxy_ethereum_address = \"0xd0d14b38d1f6b59d3772a63d84ece0a79e6e1c1f\"\nproxy_url = \"ws://95.216.15.80:44211\"\nstream_part_id = \"0xd2078dc2d780029473a39ce873fc182587be69db/low-level-client#0\"\nown_ethereum_address = \"0xa5374e3c19f15e1847881979dd0c6c9ffe846bd5\"\nethereum_private_key = \"23bead9b499af21c4c16e4511b3b6b08c3e22e76e0591f5ab5ba8d4c3a5b1820\"\n \n        \nwith LibStreamrProxyClient() as lib:\n    with ProxyClient(lib, own_ethereum_address, stream_part_id) as client:\n        result = client.connect([Proxy(proxy_url, proxy_ethereum_address)])\n        assert len(result.errors) == 0\n        assert len(result.successful) == 1\n        \n        result = client.publish(b\"Hello from python!\", ethereum_private_key)\n        assert len(result.errors) == 0\n        assert len(result.successful) == 1\n```\n\n## API documentation\n\n### Classes\n\n#### Proxy\nContains information about a proxy node in the Streamr network.\n\nMethods:\n- `__init__(websocket_url: str, ethereum_address: str)`: Initialize a Proxy instance with websocket URL and Ethereum address\n- `from_c_proxy(c_proxy)`: Create Proxy instance from C struct (internal use)\n\n#### Error\nRepresents an error from the C library.\n\nAttributes:\n- `message`: Error message string\n- `code`: Error code string \n- `proxy`: Associated Proxy instance if applicable\n\n#### ProxyClientException\nException raised when C library operations fail.\n\nAttributes:\n- `error`: The Error instance containing details\n\n#### ProxyClientResult \nResult of proxy client operations.\n\nAttributes:\n- `errors`: List of Error instances if operation had errors\n- `successful`: List of successful Proxy instances\n\n#### LibStreamrProxyClient\nWrapper for the C library. Use as context manager.\n\nMethods:\n- `__enter__()`: Load and initialize C library\n- `__exit__()`: Cleanup C library\n\n#### ProxyClient\nMain client for interacting with proxies. Use as context manager.\n\nMethods:\n- `__init__(lib: LibStreamrProxyClient, ownEthereumAddress: str, streamPartId: str)`: Initialize with library instance, Ethereum address and stream ID\n- `connect(proxies: list[Proxy]) -> ProxyClientResult`: Connect to list of proxies\n- `publish(data: bytes, ethereumPrivateKey: str = None) -> ProxyClientResult`: Publish data to connected proxies\n\n### Error Codes\n\n- `ERROR_INVALID_ETHEREUM_ADDRESS`: Invalid Ethereum address format\n- `ERROR_INVALID_STREAM_PART_ID`: Invalid stream part ID format  \n- `ERROR_PROXY_CLIENT_NOT_FOUND`: Proxy client instance not found\n- `ERROR_INVALID_PROXY_URL`: Invalid proxy websocket URL\n- `ERROR_NO_PROXIES_DEFINED`: No proxies provided\n- `ERROR_PROXY_CONNECTION_FAILED`: Failed to connect to proxy\n- `ERROR_PROXY_BROADCAST_FAILED`: Failed to broadcast message to proxy\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python bindings for libstreamrproxyclient",
    "version": "2.0.5",
    "project_urls": {
        "Documentation": "https://github.com/streamr-dev/native-sdk/tree/main/wrappers/python",
        "Homepage": "https://github.com/streamr-dev/native-sdk",
        "Repository": "https://github.com/streamr-dev/native-sdk.git"
    },
    "split_keywords": [
        "client",
        " proxy",
        " streamr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "754cdb591f23da2f67a8ad30dcaeec3a299ac344747674de4609ffede465ee34",
                "md5": "3d13e5cf165372f2407e9a58b4e9d583",
                "sha256": "fa68e7dd55aa30b4e5a3d5731893f7ff26e662a04dfe613fcce0f463e1437630"
            },
            "downloads": -1,
            "filename": "libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl",
            "has_sig": false,
            "md5_digest": "3d13e5cf165372f2407e9a58b4e9d583",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 5092,
            "upload_time": "2024-12-19T07:08:16",
            "upload_time_iso_8601": "2024-12-19T07:08:16.994112Z",
            "url": "https://files.pythonhosted.org/packages/75/4c/db591f23da2f67a8ad30dcaeec3a299ac344747674de4609ffede465ee34/libstreamrproxyclient-2.0.5-py3-none-macosx_13_6_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f7a17beabf63651e7689e1b0f7028c02fd1694d35f37ab7333b259943fc56484",
                "md5": "f43feaa780c0d4f9921e37bce65a033e",
                "sha256": "71a6b06b1f8350c1c9a8b95876910756b3480f263f3a30901ced2965b202dd2b"
            },
            "downloads": -1,
            "filename": "libstreamrproxyclient-2.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f43feaa780c0d4f9921e37bce65a033e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 4912,
            "upload_time": "2024-12-19T07:08:19",
            "upload_time_iso_8601": "2024-12-19T07:08:19.108180Z",
            "url": "https://files.pythonhosted.org/packages/f7/a1/7beabf63651e7689e1b0f7028c02fd1694d35f37ab7333b259943fc56484/libstreamrproxyclient-2.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-19 07:08:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "streamr-dev",
    "github_project": "native-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "libstreamrproxyclient"
}
        
Elapsed time: 0.40942s