Skip to main content

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:

Github

Project details


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rpc_Ariam27-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file rpc-Ariam27-0.1.0.tar.gz.

File metadata

  • Download URL: rpc-Ariam27-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for rpc-Ariam27-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a8970ce73a1769dd6a04c9f38e95e0074c58deb724647d6be4277fad8a788995
MD5 491632f6377ae27322a3a9be3c689907
BLAKE2b-256 5753c0a0f0cc32e261b76b94846985718a32f10f4ffc5ebc8cc144287c3babca

See more details on using hashes here.

File details

Details for the file rpc_Ariam27-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rpc_Ariam27-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for rpc_Ariam27-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07b6d3c602c1f0c9a82d61d339a590db3f1138ae949df84675b012b635f5dd5e
MD5 da6a2e0dcda366b94dc16be9cc36c294
BLAKE2b-256 95700ef5cfd9fa20d288fb31198ac5010e8739cc2f3f3d0d88f18ce0b25628f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page