A simple rpc implementation
Project description
RPC
A simple implementation of RPC (Remote Procedural Call) in python.
Examples:
#server implementation
from rpc import Server
server = Server("localhost", 3000)
@server.register("add")
def add(num1, num2):
return num1 + num2
@server.register("concat")
def concat(str1, str2):
return str1 + str2
@server.register("uppercase")
def uppercase(string):
return string.upper()
server.run()
#client implementation
from rpc import Client
client = Client("localhost", 3000)
client.connect()
print(client.execute("/"))
#prints: ["add", "concat", "uppercase"]
print(client.execute("add", 1, 2))
#prints: 3
print(client.execute("concat", "a", "b"))
#prints: ab
print(client.execute("uppercase", "example"))
#prints: EXAMPLE
client.close()
#closes the socket connection
Links:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rpc-Ariam27-0.1.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for rpc_Ariam27-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07b6d3c602c1f0c9a82d61d339a590db3f1138ae949df84675b012b635f5dd5e |
|
MD5 | da6a2e0dcda366b94dc16be9cc36c294 |
|
BLAKE2b-256 | 95700ef5cfd9fa20d288fb31198ac5010e8739cc2f3f3d0d88f18ce0b25628f3 |