# UNREALIRCD-RPC-PY






## Introduction
If you are using Python3, this package can help you to parse all json responses it does all the work for you.
## How to install this package
```bash
pip3 install unrealircd_rpc_py
```
> [!NOTE]
> I recommend installing a virtual environment and then installing the package within it.
## How to establish the link
### Using requests module
```python
from unrealircd_rpc_py.Loader import Loader
# Using requests method
rpc = Loader(
req_method='requests',
url='https://your.irc.domaine.org:8600/api',
username='apiname',
password='apiPASSWORD'
)
```
### Using socket method
```python
from unrealircd_rpc_py.Loader import Loader
# Using socket method
rpc = Loader(
req_method='socket',
url='https://your.irc.domaine.org:8600/api',
username='apiname',
password='apiPASSWORD'
)
```
### Using unixsocket method (Local only)
```python
from unrealircd_rpc_py.Loader import Loader
# Using unixsocket method (Local only)
rpc = Loader(
req_method='unixsocket',
path_to_socket_file='/path/to/unrealircd/data/rpc.socket'
)
```
### Live Connection using UnixSocket (Local Only)
```python
from unrealircd_rpc_py.Live import LiveUnixSocket
# Live Connection (Local only) using unix socket
LiveRpc = LiveUnixSocket(
callback_object_instance=Callback_class_instance,
callback_method_name='your_method_name',
path_to_socket_file='/path/to/unrealircd/data/rpc.socket'
)
```
### Live connection using Websocket (Local or Remote)
```python
from unrealircd_rpc_py.Live import LiveWebsocket
# Live Connection (Local Or Remote) using websocket
liveRpc = LiveWebsocket(
callback_object_instance=InitCallbackClass,
callback_method_name='your_method_name',
url='https://your.irc.domaine.org:8600/api',
username='apiname',
password='apiPASSWORD'
)
```
## How to work with remotly
This package allows easy interfacing with UnrealIRCd through regular Python3 code, such as:
```python
from unrealircd_rpc_py.Loader import Loader
# Initialize your connexion to unrealircd
rpc = Loader(
req_method='requests', # you can also use 'socket'
url='https://your.irc.domaine.org:8600/api',
username='apiname',
password='apiPASSWORD'
)
# Enjoy the power of JSON-RPC
User = rpc.User
response = User.get('adator')
print(f'Nickname: {response.name}')
print(f'Ip: {response.ip}')
Channels = rpc.Channel
response = Channels.list_(_object_detail_level=3)
for chan in Channels:
print(f'-' * 16)
print(f'Channel: {chan.name}')
print(f'Created on: {chan.creation_time}')
print(f'Bans: {chan.bans}')
print(f'Members: {chan.members}')
print(f'-' * 16)
```
## How to work with (using unix socket locally)
This package allows easy interfacing with UnrealIRCd through regular Python3 code, such as:
```python
from unrealircd_rpc_py.Loader import Loader
# Initialize your connexion to unrealircd
rpc = Loader(
req_method='unixsocket',
path_to_socket_file='/path/to/unrealircd/data/rpc.socket'
)
# Enjoy the power of JSON-RPC
User = rpc.User
response = User.get('adator')
# Handling errors
if rpc.get_error.code != 0:
# if code is not 0 then there is an error
print(f"Your Error Message: {rpc.get_error.message}")
# You can also access errors like so:
if User.get_error.code != 0:
print(f"Your Error Message: {User.get_error.message}")
print(f'Nickname: {response.name}')
print(f'Ip: {response.ip}')
Channels = rpc.Channel
response = Channels.list_(_object_detail_level=3)
# The auto completion should help you to find all available attributes
for chan in Channels:
print(f'-' * 16)
print(f'Channel: {chan.name}')
print(f'Created on: {chan.creation_time}')
print(f'Bans: {chan.bans}')
print(f'Members: {chan.members}')
print(f'-' * 16)
```
## Object that you can use in a synchrone mode
```python
from unrealircd_rpc_py.Loader import Loader
# Initialize your connexion to unrealircd using one of the three method
rpc = Loader(
req_method='unixsocket',
path_to_socket_file='/path/to/unrealircd/data/rpc.socket'
)
Channel = rpc.Channel
Name_ban = rpc.Name_ban
Server_ban_exception = rpc.Server_ban_exception
Server_ban = rpc.Server_ban
Spamfilter = rpc.Spamfilter
Stats = rpc.Stats
User = rpc.User
Whowas = rpc.Whowas
Log = rpc.Log # This feature requires unrealIRCd 6.1.8 or higher
```
# Live Connection via unixsocket or websocket
## How to work with (using Live unixsocket)
```python
from unrealircd_rpc_py.Live import LiveUnixSocket
# This is un callback class that will recieve the response
from TestObject import TestObject
InitCallbackClass = TestObject()
# The Callback method must always have 1 parameter as string
liveRpc = LiveUnixSocket(
callback_object_instance=InitCallbackClass,
callback_method_name='your_method_name',
path_to_socket_file='/path/to/unrealircd/data/rpc.socket'
)
# This method will run forever and will send to your callback method the response
# in SimpleNameSpace type that you can parse
if liveRpc.get_error.code == 0:
# Subscribe to live events
liveRpc.subscribe()
else:
# If error show the error message
print(liveRpc.get_error.message)
```
## How to work with (using Live websocket)
```python
from unrealircd_rpc_py.Live import LiveWebsocket
# This is un callback class that will recieve the response
from TestObject import TestObject
InitCallbackClass = TestObject()
# The Callback method must always have 1 parameter as string
liveRpc = LiveWebsocket(
callback_object_instance=InitCallbackClass,
callback_method_name='your_method_name',
url='https://your.irc.domaine.org:8600/api',
username='apiname',
password='apiPASSWORD'
)
# This method will run forever and will send to your callback method the response
# in SimpleNameSpace type that you can parse
if liveRpc.get_error.code == 0:
# Subscribe to live events
liveRpc.subscribe()
else:
# If error show the error message
print(liveRpc.get_error.message)
```
## Exemple of a Callback Class
```python
class CallbackObject:
def __init__(self) -> None:
pass
def run(self, json_response) -> bool:
print(json_response)
if type(json_response.result) != bool:
print(json_response.result.channel)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/adator85/unrealircd_rpc_py",
"name": "unrealircd-rpc-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "Unrealircd, irc, jsonrpc, json-rpc, ircd",
"author": "adator",
"author_email": "debian@deb.biz.st",
"download_url": "https://files.pythonhosted.org/packages/50/5c/722dce6fe7cf89828a3047cebf6f149d9a36b2b7e1917de8338c6ff83f75/unrealircd_rpc_py-2.0.5.tar.gz",
"platform": null,
"description": "# UNREALIRCD-RPC-PY\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n## Introduction\r\nIf you are using Python3, this package can help you to parse all json responses it does all the work for you.\r\n\r\n## How to install this package\r\n```bash\r\n pip3 install unrealircd_rpc_py\r\n```\r\n> [!NOTE]\r\n> I recommend installing a virtual environment and then installing the package within it.\r\n\r\n## How to establish the link\r\n### Using requests module\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n # Using requests method\r\n rpc = Loader(\r\n req_method='requests',\r\n url='https://your.irc.domaine.org:8600/api',\r\n username='apiname',\r\n password='apiPASSWORD'\r\n )\r\n```\r\n### Using socket method\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n # Using socket method\r\n rpc = Loader(\r\n req_method='socket',\r\n url='https://your.irc.domaine.org:8600/api',\r\n username='apiname',\r\n password='apiPASSWORD'\r\n )\r\n```\r\n### Using unixsocket method (Local only)\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n # Using unixsocket method (Local only)\r\n rpc = Loader(\r\n req_method='unixsocket',\r\n path_to_socket_file='/path/to/unrealircd/data/rpc.socket'\r\n )\r\n```\r\n### Live Connection using UnixSocket (Local Only)\r\n```python\r\n from unrealircd_rpc_py.Live import LiveUnixSocket\r\n # Live Connection (Local only) using unix socket\r\n LiveRpc = LiveUnixSocket(\r\n callback_object_instance=Callback_class_instance,\r\n callback_method_name='your_method_name',\r\n path_to_socket_file='/path/to/unrealircd/data/rpc.socket'\r\n )\r\n```\r\n### Live connection using Websocket (Local or Remote)\r\n```python\r\n from unrealircd_rpc_py.Live import LiveWebsocket\r\n # Live Connection (Local Or Remote) using websocket\r\n liveRpc = LiveWebsocket(\r\n callback_object_instance=InitCallbackClass,\r\n callback_method_name='your_method_name',\r\n url='https://your.irc.domaine.org:8600/api',\r\n username='apiname',\r\n password='apiPASSWORD'\r\n )\r\n```\r\n## How to work with remotly\r\nThis package allows easy interfacing with UnrealIRCd through regular Python3 code, such as:\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n\r\n # Initialize your connexion to unrealircd\r\n rpc = Loader(\r\n req_method='requests', # you can also use 'socket'\r\n url='https://your.irc.domaine.org:8600/api',\r\n username='apiname',\r\n password='apiPASSWORD'\r\n )\r\n\r\n # Enjoy the power of JSON-RPC\r\n\r\n User = rpc.User\r\n response = User.get('adator')\r\n\r\n print(f'Nickname: {response.name}')\r\n print(f'Ip: {response.ip}')\r\n\r\n Channels = rpc.Channel\r\n response = Channels.list_(_object_detail_level=3)\r\n\r\n for chan in Channels:\r\n print(f'-' * 16)\r\n print(f'Channel: {chan.name}')\r\n print(f'Created on: {chan.creation_time}')\r\n print(f'Bans: {chan.bans}')\r\n print(f'Members: {chan.members}')\r\n print(f'-' * 16)\r\n```\r\n## How to work with (using unix socket locally)\r\n\r\nThis package allows easy interfacing with UnrealIRCd through regular Python3 code, such as:\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n\r\n # Initialize your connexion to unrealircd\r\n rpc = Loader(\r\n req_method='unixsocket',\r\n path_to_socket_file='/path/to/unrealircd/data/rpc.socket'\r\n )\r\n\r\n # Enjoy the power of JSON-RPC\r\n User = rpc.User\r\n response = User.get('adator')\r\n \r\n # Handling errors\r\n if rpc.get_error.code != 0:\r\n # if code is not 0 then there is an error\r\n print(f\"Your Error Message: {rpc.get_error.message}\")\r\n \r\n # You can also access errors like so:\r\n if User.get_error.code != 0:\r\n print(f\"Your Error Message: {User.get_error.message}\")\r\n\r\n print(f'Nickname: {response.name}')\r\n print(f'Ip: {response.ip}')\r\n\r\n Channels = rpc.Channel\r\n response = Channels.list_(_object_detail_level=3)\r\n\r\n # The auto completion should help you to find all available attributes\r\n for chan in Channels:\r\n print(f'-' * 16)\r\n print(f'Channel: {chan.name}')\r\n print(f'Created on: {chan.creation_time}')\r\n print(f'Bans: {chan.bans}')\r\n print(f'Members: {chan.members}')\r\n print(f'-' * 16)\r\n```\r\n## Object that you can use in a synchrone mode\r\n```python\r\n from unrealircd_rpc_py.Loader import Loader\r\n\r\n # Initialize your connexion to unrealircd using one of the three method\r\n rpc = Loader(\r\n req_method='unixsocket',\r\n path_to_socket_file='/path/to/unrealircd/data/rpc.socket'\r\n )\r\n\r\n Channel = rpc.Channel\r\n Name_ban = rpc.Name_ban\r\n Server_ban_exception = rpc.Server_ban_exception\r\n Server_ban = rpc.Server_ban\r\n Spamfilter = rpc.Spamfilter\r\n Stats = rpc.Stats\r\n User = rpc.User\r\n Whowas = rpc.Whowas\r\n Log = rpc.Log # This feature requires unrealIRCd 6.1.8 or higher\r\n\r\n```\r\n# Live Connection via unixsocket or websocket\r\n## How to work with (using Live unixsocket)\r\n```python\r\n from unrealircd_rpc_py.Live import LiveUnixSocket\r\n\r\n # This is un callback class that will recieve the response\r\n from TestObject import TestObject\r\n\r\n InitCallbackClass = TestObject()\r\n\r\n # The Callback method must always have 1 parameter as string\r\n liveRpc = LiveUnixSocket(\r\n callback_object_instance=InitCallbackClass,\r\n callback_method_name='your_method_name',\r\n path_to_socket_file='/path/to/unrealircd/data/rpc.socket'\r\n )\r\n\r\n # This method will run forever and will send to your callback method the response\r\n # in SimpleNameSpace type that you can parse\r\n if liveRpc.get_error.code == 0:\r\n # Subscribe to live events\r\n liveRpc.subscribe()\r\n else:\r\n # If error show the error message\r\n print(liveRpc.get_error.message)\r\n```\r\n## How to work with (using Live websocket)\r\n```python\r\n from unrealircd_rpc_py.Live import LiveWebsocket\r\n\r\n # This is un callback class that will recieve the response\r\n from TestObject import TestObject\r\n\r\n InitCallbackClass = TestObject()\r\n\r\n # The Callback method must always have 1 parameter as string\r\n liveRpc = LiveWebsocket(\r\n callback_object_instance=InitCallbackClass,\r\n callback_method_name='your_method_name',\r\n url='https://your.irc.domaine.org:8600/api',\r\n username='apiname',\r\n password='apiPASSWORD'\r\n )\r\n\r\n # This method will run forever and will send to your callback method the response\r\n # in SimpleNameSpace type that you can parse\r\n if liveRpc.get_error.code == 0:\r\n # Subscribe to live events\r\n liveRpc.subscribe()\r\n else:\r\n # If error show the error message\r\n print(liveRpc.get_error.message)\r\n```\r\n\r\n## Exemple of a Callback Class\r\n```python\r\n class CallbackObject:\r\n\r\n def __init__(self) -> None:\r\n pass\r\n\r\n def run(self, json_response) -> bool:\r\n\r\n print(json_response)\r\n\r\n if type(json_response.result) != bool:\r\n print(json_response.result.channel)\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for UnrealIRCd json-rpc",
"version": "2.0.5",
"project_urls": {
"Homepage": "https://github.com/adator85/unrealircd_rpc_py"
},
"split_keywords": [
"unrealircd",
" irc",
" jsonrpc",
" json-rpc",
" ircd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3a27de437aa7574fa4acc8796bf044346167627d249c552e480b34180332f666",
"md5": "55b009939fd51b771ecfc3fc69842ce1",
"sha256": "71b1dfd1052c553f3882c2c8b80edac62db6fa9b982ee61c6d7d27117a2ec1cc"
},
"downloads": -1,
"filename": "unrealircd_rpc_py-2.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "55b009939fd51b771ecfc3fc69842ce1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 35966,
"upload_time": "2025-08-20T23:05:54",
"upload_time_iso_8601": "2025-08-20T23:05:54.653093Z",
"url": "https://files.pythonhosted.org/packages/3a/27/de437aa7574fa4acc8796bf044346167627d249c552e480b34180332f666/unrealircd_rpc_py-2.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "505c722dce6fe7cf89828a3047cebf6f149d9a36b2b7e1917de8338c6ff83f75",
"md5": "0a4425cfea96a469feb43c9fc81a9dbd",
"sha256": "53c74a51f1ba535a3953e125e71581239a6b4cd3bf145558b27c4daa2f40f62f"
},
"downloads": -1,
"filename": "unrealircd_rpc_py-2.0.5.tar.gz",
"has_sig": false,
"md5_digest": "0a4425cfea96a469feb43c9fc81a9dbd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 26841,
"upload_time": "2025-08-20T23:05:56",
"upload_time_iso_8601": "2025-08-20T23:05:56.168255Z",
"url": "https://files.pythonhosted.org/packages/50/5c/722dce6fe7cf89828a3047cebf6f149d9a36b2b7e1917de8338c6ff83f75/unrealircd_rpc_py-2.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 23:05:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adator85",
"github_project": "unrealircd_rpc_py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "unrealircd-rpc-py"
}