Skip to main content

REdis Msgpack RPC

Installation

pip install remrpc

Example

import redis
import remrpc

def add(a, b):
    return a + b

def sub(a, b):
    return a - b

def multi():
    return "Hello", "World"

def kvfunc(k="key", v="val"):
    return "{0} = {1}".format(k, v)

def nonreturn():
    print("Non Return")

class CallObject:
    def __call__(self, name):
        return "Hello {0}".format(name)

if __name__ == "__main__":
    pool = redis.ConnectionPool(host="127.0.0.1",
                                port=6379,
                                password="123456")
    rpc1 = remrpc.RPC(redis.Redis(connection_pool=pool), "channel:rpc1")
    rpc2 = remrpc.RPC(redis.Redis(connection_pool=pool), "channel:rpc2")

    rpc1.register(add)
    rpc1.register(sub)
    rpc1.register(multi)
    rpc1.register(kvfunc)
    rpc1.register(CallObject(), 'sayhello')
    rpc1.register(nonreturn)

    try:
        invoker = rpc2.invoker("channel:rpc1")

        print(invoker.add(1, 2))
        print(invoker.sub(9, 5))
        print(invoker.multi())
        print(invoker.kvfunc(k="KEY", v="VALUE"))
        print(invoker.sayhello("World"))
        print(invoker.nonreturn())
        print(invoker.nonexistent())
    except remrpc.TimedoutRPC as e:
        print("> RPC Timedout: {0}".format(e))
    except remrpc.CallErrorRPC as e:
        print("> RPC Call Error: {0}".format(e))
    except remrpc.ExceptionRPC as e:
        print("> RPC Exception: {0}".format(e))

    rpc1.close()
    rpc2.close()

Release files for remrpc 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for remrpc 0.1.11
File Size Uploaded
remrpc-0.1.11.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for remrpc 0.1.11
File Interpreter ABI Platform
remrpc-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / remrpc-0.1.11.tar.gz

Download URL remrpc-0.1.11.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f5bfe2af1702090ef34ce8a517eea3f9876ff7ba50f5a8f65e101d453f8b671e
BLAKE2b-256 checksum
How to use checksums
cefcc476b4ddc674fcb5b36195bdd12ffc208be85bc1f8477047ba54f442813f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Release files / remrpc-0.1.11-py3-none-any.whl

Download URL remrpc-0.1.11-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cfcde76379f3098c0c14713ee0b7a528b6a9f7a5abe78316b348814b318f303
BLAKE2b-256 checksum
How to use checksums
009afa766f3d93ef60bb568e2c566c417d751d00dd8635ec0cc3d6001141a3b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page