PyEasyRPC
PyEaseRPC is a Python RPC framework easy to use, which using Redis as backend.
Example
Server
# example_server.py
from pyeasyrpc.rpc import remote_method
from pyeasyrpc.rpc import RPCService
class ServiceInstance(RPCService):
@remote_method
def add(self, a, b):
return a + b
@remote_method
def sub(self, a, b):
return a - b
@remote_method
def make_dict(self, **kwargs):
return dict(kwargs)
@remote_method
def make_list(self, *args):
return list(args)
def main():
instance0 = ServiceInstance(process_request_in_thread=True)
instance0.start_background_running()
input("press any key to stop")
instance0.stop_background_running()
if __name__ == '__main__':
main()
Client
# example_client.py
from pyeasyrpc.rpc import RPCClient
def main():
client = RPCClient("ServiceInstance")
print("method_list", client.get_methods())
print("add", client.add(1, 2))
print("sub", client.sub(100, 1.1))
print("make_dict", client.make_dict(a=1, b=2, c=3))
print("make_list", client.make_list(1, [2], {3}))
try:
client.add()
except Exception as ex:
print(type(ex), ex)
if __name__ == '__main__':
main()
Async Client
# example_client_async.py
import asyncio
from pyeasyrpc.rpc import AsyncRPCClient
def main():
client = AsyncRPCClient("ServiceInstance")
print("method_list", client.get_methods())
async def add():
print("add", await client.add(1, 2))
async def sub():
print("sub", await client.sub(100, 1.1))
async def make_dict():
print("make_dict", await client.make_dict(a=1, b=2, c=3))
async def make_list():
print("make_list", await client.make_list(1, [2], {3}))
async def catch_exception():
try:
await client.add()
except Exception as ex:
print(type(ex), ex)
async def func():
task = [add(), sub(), make_list(), make_dict(), catch_exception()]
# task.extend([add() for i in range(100)])
# task.extend([sub() for i in range(100)])
# task.extend([make_list() for i in range(100)])
# task.extend([make_dict() for i in range(100)])
# task.extend([catch_exception() for i in range(100)])
await asyncio.wait(task)
loop = asyncio.get_event_loop()
loop.run_until_complete(func())
if __name__ == '__main__':
main()
Metadata
Release files for pyeasyrpc 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyeasyrpc-0.0.1.tar.gz | 15.0 kB | Without provenance | Details for pyeasyrpc-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyeasyrpc-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyeasyrpc-0.0.1-py3-none-any.whl |
Total release size: 38.9 kB
Release files / pyeasyrpc-0.0.1.tar.gz
| Download URL | pyeasyrpc-0.0.1.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
107086074e1642b8b629596b0be4c382993b9c577f1c2e34086daaa04ef90349
|
|
BLAKE2b-256 checksum How to use checksums |
443d2ba91e3c39040a3862c73542cca6a518898042947c5552948961125e578c
|
| 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/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.4
|
Release files / pyeasyrpc-0.0.1-py3-none-any.whl
| Download URL | pyeasyrpc-0.0.1-py3-none-any.whl |
|---|---|
| Size | 23.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d6362a7c9b6c1fa4864d564d78ba4d93c2044417a24562e71c4168226c2dde6
|
|
BLAKE2b-256 checksum How to use checksums |
66959e4ab1fd646d340a14d4a69ba139be3458370633698e38893f42b1b8f90a
|
| 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/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.4
|
Security for pyeasyrpc 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.