# Hyperion Stream Client
[](https://pypi.org/project/hyperion-stream-client/)

### Installation
PyPI
```bash
pip install -U hyperion-stream-client
```
### Usage
```python
from contextlib import suppress
from hyperion.hyperion_stream_client import HyperionClientOptions, HyperionStreamClient, StreamActionsRequest
import asyncio
async def data_handler(data):
print(data)
async def main():
options = HyperionClientOptions(
endpoint="https://proton.eosusa.io", debug=True, lib_stream=False
)
client = HyperionStreamClient(options)
# Set the custom handler
client.async_data_handler = data_handler
try:
# Connect the client
await client.connect()
# Stream actions
await client.stream_actions(
StreamActionsRequest(
contract="swap.alcor",
account="swap.alcor",
action="logswap",
start_from="LIB",
read_until=0,
)
)
except Exception as e:
print(f"Error: {e}")
while True:
await asyncio.sleep(1)
if __name__ == "__main__":
with suppress(KeyboardInterrupt):
asyncio.run(main())
```
## Class
```python
from contextlib import suppress
from hyperion.hyperion_stream_client import HyperionClientOptions,HyperionStreamClient,StreamActionsRequest
import asyncio
class EventListener(HyperionStreamClient):
def __init__(self):
options = HyperionClientOptions(
endpoint="https://proton.eosusa.io", debug=True, lib_stream=False
)
super().__init__(options)
self.async_data_handler = self.data_handler
self.async_lib_data_handler = self.lib_data_handler
async def start(self):
# Make connection first
try:
await self.connect()
# Stream Actions
await self.stream_actions(
StreamActionsRequest(
contract="swap.alcor",
account="swap.alcor",
action="logswap",
start_from="LIB",
read_until=0,
)
)
except Exception as e:
print(e)
while True:
await asyncio.sleep(1)
async def data_handler(self, data):
print(data)
async def lib_data_handler(self, data):
print(data)
if __name__ == "__main__":
with suppress(KeyboardInterrupt) as _err:
asyncio.run(EventListener().start())
```
## License
[MIT](https://choosealicense.com/licenses/mit/)
Raw data
{
"_id": null,
"home_page": "https://github.com/debugtitan/hyperion-stream-client.git",
"name": "hyperion-stream-client",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Uche David",
"author_email": "alts.devs@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/88/8a/1a8e5f7a498ee92c27db87324d7ac3f73f048161830cde88820669c06667/hyperion_stream_client-1.0.1.tar.gz",
"platform": null,
"description": "# Hyperion Stream Client\n\n[](https://pypi.org/project/hyperion-stream-client/)\n\n\n### Installation\n\nPyPI\n\n```bash\npip install -U hyperion-stream-client\n```\n\n### Usage\n\n```python\n from contextlib import suppress\n from hyperion.hyperion_stream_client import HyperionClientOptions, HyperionStreamClient, StreamActionsRequest\n import asyncio\n\n async def data_handler(data):\n print(data)\n\n async def main():\n options = HyperionClientOptions(\n endpoint=\"https://proton.eosusa.io\", debug=True, lib_stream=False\n )\n client = HyperionStreamClient(options)\n\n # Set the custom handler\n client.async_data_handler = data_handler\n\n try:\n # Connect the client\n await client.connect()\n\n # Stream actions\n await client.stream_actions(\n StreamActionsRequest(\n contract=\"swap.alcor\",\n account=\"swap.alcor\",\n action=\"logswap\",\n start_from=\"LIB\",\n read_until=0,\n )\n )\n except Exception as e:\n print(f\"Error: {e}\")\n\n while True:\n await asyncio.sleep(1)\n\n if __name__ == \"__main__\":\n with suppress(KeyboardInterrupt):\n asyncio.run(main())\n\n```\n\n## Class\n```python\n from contextlib import suppress\n from hyperion.hyperion_stream_client import HyperionClientOptions,HyperionStreamClient,StreamActionsRequest\n import asyncio\n\n\n class EventListener(HyperionStreamClient):\n def __init__(self):\n options = HyperionClientOptions(\n endpoint=\"https://proton.eosusa.io\", debug=True, lib_stream=False\n )\n super().__init__(options)\n self.async_data_handler = self.data_handler\n self.async_lib_data_handler = self.lib_data_handler\n\n async def start(self):\n # Make connection first\n try:\n await self.connect()\n\n # Stream Actions\n await self.stream_actions(\n StreamActionsRequest(\n contract=\"swap.alcor\",\n account=\"swap.alcor\",\n action=\"logswap\",\n start_from=\"LIB\",\n read_until=0,\n )\n )\n except Exception as e:\n print(e)\n\n while True:\n await asyncio.sleep(1)\n\n async def data_handler(self, data):\n print(data)\n\n async def lib_data_handler(self, data):\n print(data)\n\n\n if __name__ == \"__main__\":\n with suppress(KeyboardInterrupt) as _err:\n asyncio.run(EventListener().start())\n```\n\n\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Streaming Client for Hyperion History API",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/debugtitan/hyperion-stream-client.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f7fff4cc0daa0ed3151307f5221b69fa7540248235089f1bbccd1d9bd7ae1d6c",
"md5": "7b4f7328830d76e11536b9e39896ad0d",
"sha256": "bc83c3d49780ae7d7a32ba0913a27f1e681fdd5d1a75cdf18628375297f5df34"
},
"downloads": -1,
"filename": "hyperion_stream_client-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7b4f7328830d76e11536b9e39896ad0d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7635,
"upload_time": "2024-12-08T10:37:37",
"upload_time_iso_8601": "2024-12-08T10:37:37.685018Z",
"url": "https://files.pythonhosted.org/packages/f7/ff/f4cc0daa0ed3151307f5221b69fa7540248235089f1bbccd1d9bd7ae1d6c/hyperion_stream_client-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "888a1a8e5f7a498ee92c27db87324d7ac3f73f048161830cde88820669c06667",
"md5": "3673c3fff09c9a81dd940f9cc66a0462",
"sha256": "01653e8c14d8968bb183ff90097c76df6f0b5ab4be7a5309b5b061c35a948d6c"
},
"downloads": -1,
"filename": "hyperion_stream_client-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3673c3fff09c9a81dd940f9cc66a0462",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7208,
"upload_time": "2024-12-08T10:37:40",
"upload_time_iso_8601": "2024-12-08T10:37:40.143720Z",
"url": "https://files.pythonhosted.org/packages/88/8a/1a8e5f7a498ee92c27db87324d7ac3f73f048161830cde88820669c06667/hyperion_stream_client-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-08 10:37:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "debugtitan",
"github_project": "hyperion-stream-client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "aiohappyeyeballs",
"specs": [
[
"==",
"2.4.4"
]
]
},
{
"name": "aiohttp",
"specs": [
[
"==",
"3.11.10"
]
]
},
{
"name": "aiosignal",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"24.2.0"
]
]
},
{
"name": "bidict",
"specs": [
[
"==",
"0.23.1"
]
]
},
{
"name": "build",
"specs": [
[
"==",
"1.2.2.post1"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.8.30"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.17.1"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"44.0.0"
]
]
},
{
"name": "docutils",
"specs": [
[
"==",
"0.21.2"
]
]
},
{
"name": "frozenlist",
"specs": [
[
"==",
"1.5.0"
]
]
},
{
"name": "h11",
"specs": [
[
"==",
"0.14.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "jaraco.classes",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "jaraco.context",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "jaraco.functools",
"specs": [
[
"==",
"4.1.0"
]
]
},
{
"name": "jeepney",
"specs": [
[
"==",
"0.8.0"
]
]
},
{
"name": "keyring",
"specs": [
[
"==",
"25.5.0"
]
]
},
{
"name": "loguru",
"specs": [
[
"==",
"0.7.3"
]
]
},
{
"name": "markdown-it-py",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "mdurl",
"specs": [
[
"==",
"0.1.2"
]
]
},
{
"name": "more-itertools",
"specs": [
[
"==",
"10.5.0"
]
]
},
{
"name": "multidict",
"specs": [
[
"==",
"6.1.0"
]
]
},
{
"name": "nh3",
"specs": [
[
"==",
"0.2.19"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "pkginfo",
"specs": [
[
"==",
"1.12.0"
]
]
},
{
"name": "propcache",
"specs": [
[
"==",
"0.2.1"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.22"
]
]
},
{
"name": "Pygments",
"specs": [
[
"==",
"2.18.0"
]
]
},
{
"name": "pyproject_hooks",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "python-engineio",
"specs": [
[
"==",
"4.10.1"
]
]
},
{
"name": "python-socketio",
"specs": [
[
"==",
"5.11.4"
]
]
},
{
"name": "readme_renderer",
"specs": [
[
"==",
"44.0"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "requests-toolbelt",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "rfc3986",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"13.9.4"
]
]
},
{
"name": "SecretStorage",
"specs": [
[
"==",
"3.3.3"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"75.6.0"
]
]
},
{
"name": "simple-websocket",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "twine",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.3"
]
]
},
{
"name": "wsproto",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "yarl",
"specs": [
[
"==",
"1.18.3"
]
]
}
],
"lcname": "hyperion-stream-client"
}