# RELP server/client for python
[](https://github.com/wtnb75/relppy/actions/workflows/main.yml)
## install
- pip install relppy
## example
### server
```python
import socketserver
from relppy.server import RelpStreamHandler
from relppy.protocol import Message
class MyHandler(RelpStreamHandler):
def do_syslog(self, msg: Message):
print(msg.data.decode("ascii"))
if __name__ == "__main__":
srv = socketserver.TCPServer(("localhost", 10514), MyHandler)
srv.serve_forever()
```
### client
```python
from relppy.client import RelpTCPClient
with RelpTCPClient(("localhost", 10514)) as cl:
for m in ["hello", "world"]:
fut= cl.send_command(b"syslog", m.encode())
res = fut.result()
print(f"sent: {m} -> {res}")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/wtnb75/relppy",
"name": "relppy",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Watanabe Takashi",
"author_email": "wtnb75@gmail.com",
"download_url": null,
"platform": null,
"description": "# RELP server/client for python\n\n[](https://github.com/wtnb75/relppy/actions/workflows/main.yml)\n\n## install\n\n- pip install relppy\n\n## example\n\n### server\n\n```python\nimport socketserver\nfrom relppy.server import RelpStreamHandler\nfrom relppy.protocol import Message\n\n\nclass MyHandler(RelpStreamHandler):\n def do_syslog(self, msg: Message):\n print(msg.data.decode(\"ascii\"))\n\n\nif __name__ == \"__main__\":\n srv = socketserver.TCPServer((\"localhost\", 10514), MyHandler)\n srv.serve_forever()\n```\n\n### client\n\n```python\nfrom relppy.client import RelpTCPClient\n\nwith RelpTCPClient((\"localhost\", 10514)) as cl:\n for m in [\"hello\", \"world\"]:\n fut= cl.send_command(b\"syslog\", m.encode())\n res = fut.result()\n print(f\"sent: {m} -> {res}\")\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "RELP protocol server",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/wtnb75/relppy"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "682c1d7ae927378c9a8c99b3491bed516952de72be34055544acaa30b31fd0dd",
"md5": "5f9be546a3e806cd04326e30affa3133",
"sha256": "5129df207d49180e315b715bd3cc443d12179b9be74391871032e6d6aa40b415"
},
"downloads": -1,
"filename": "relppy-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5f9be546a3e806cd04326e30affa3133",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9879,
"upload_time": "2025-01-26T02:13:37",
"upload_time_iso_8601": "2025-01-26T02:13:37.093364Z",
"url": "https://files.pythonhosted.org/packages/68/2c/1d7ae927378c9a8c99b3491bed516952de72be34055544acaa30b31fd0dd/relppy-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-26 02:13:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wtnb75",
"github_project": "relppy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": []
}
],
"lcname": "relppy"
}