procbridge-python
ProcBridge is a super-lightweight IPC (Inter-Process Communication) protocol over TCP socket or Unix domain socket. It enables you to send and recieve JSON between processes easily. ProcBridge is much like a simplified version of HTTP protocol, but only transfer JSON values.
Please note that this repo is the Python implementation of ProcBridge protocol. You can find detailed introduction of ProcBridge protocol in the main repository: gongzhang/procbridge.
Installation
pip install procbridge==1.2.1
Example
Server Side:
import procbridge as pb
def delegate(method, args):
# define remote methods:
if method == 'echo':
return args
elif method == 'sum':
return sum(x for x in args)
elif method == 'err':
raise RuntimeError("an server error")
if __name__ == '__main__':
PORT = 8000
s = pb.Server('0.0.0.0', PORT, delegate)
s.start(daemon=False)
print("Server is on {}...".format(PORT))
Client Side:
import procbridge as pb
client = pb.Client('127.0.0.1', 8000)
# call remote methods:
client.request("echo", 123) # 123
client.request("echo", ['a', 'b', 'c']) # ['a', 'b', 'c']
client.request("sum", [1, 2, 3, 4]) # 10
Metadata
Release files for procbridge 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| procbridge-1.2.2.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| procbridge-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / procbridge-1.2.2.tar.gz
| Download URL | procbridge-1.2.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b1b944d8cec978387d35cdeccd5fe10305c3cb34584b139dbcc40e150f8f035
|
|
BLAKE2b-256 checksum How to use checksums |
d335be0d61d9a5c4950b9ca44da1c8dc371bdfc2467b8e0a5af85f4be85d75b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / procbridge-1.2.2-py3-none-any.whl
| Download URL | procbridge-1.2.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e1675126c873fe163b055bca7e9802183ec7ce2711fafe42862b616653aa9be
|
|
BLAKE2b-256 checksum How to use checksums |
07b67cf6935a1ab73e6f971f23c2ab13cd4e55eb77b8385e39491f9d3c990a6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|