===
This library provides a base class and some decorators to make it easy to build distributed applications. RPC endpoints are defined as class methods and decorated with ```RpcModule.Method```, which registers the endpoint with the event-based RPC server dispatching requests to registered methods.
The ```RpcRemote``` class is an abstraction allowing applications to invoke methods on remote nodes using method call syntax. See the example below for an illustration!
```python
'''
Simple RPC server responding to invocations of the
'hello' method with a pleasant greeting
'''
import sys
from thinrpc import RpcModule, RpcRemote, RpcApplication, OK
class FooNode(RpcApplication):
def __init__(self, port, name):
self.addr = ("localhost", port)
self.name = name
# Start the RPC server
self.Start()
@RpcModule.Method
def hello(self, sender):
return OK, "Hi, %s! It's %s" % (sender, self.name)
if __name__ == '__main__':
node = FooNode(9090, "Anson")
```
And now for a simple client script that invokes the ```hello``` method on the server application defined above.
```python
import thinrpc
import sys
# Say hi to the server!
server = thinrpc.RpcRemote(("localhost", 9090))
print(server.hello())
#{'result': "Hi, ('127.0.0.1', 49440)! It's Anson", 'err': False}
```
Metadata
Release files for thinrpc 0.2.0
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 |
|---|---|---|---|---|
| thinrpc-0.2.0.tar.gz | 4.4 kB | Without provenance | Details for thinrpc-0.2.0.tar.gz |
Release files / thinrpc-0.2.0.tar.gz
| Download URL | thinrpc-0.2.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab45a91be8fa051e68b376041ae3a58774a2e6d026aa3ae137182014765cbf38
|
|
BLAKE2b-256 checksum How to use checksums |
fc8279b27a4a8f6333b317e7c392c3246a7c51af663839d6fc97dccb6f636d9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for thinrpc 0.2.0
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.