a python RPC library based on websocket
Project description
pyjznet
====
python implementation of jznet
## Requirements
You need install gevent and gevent-websocket manually
* gevent
* gevent-websocket
## Install
pip install jznet
## Usage
>>> import pyjznet
>>> from pyjznet import Server
>>> class DemoService(object):
def sayHi(self, name, remote_service):
try:
age = remote_service.call_rpc('demo', 'getAge')
except Exception as e:
logging.error(e)
return str(e)
logging.info('got say hi request of %s who's age is %d' % (name, age))
return "Hi, %s who's age is %d!" % (name, age)
>>> server = Server()
>>> server.add_rpc_service('demo', DemoService())
>>> server.start()
call the service using jznet.js library
====
python implementation of jznet
## Requirements
You need install gevent and gevent-websocket manually
* gevent
* gevent-websocket
## Install
pip install jznet
## Usage
>>> import pyjznet
>>> from pyjznet import Server
>>> class DemoService(object):
def sayHi(self, name, remote_service):
try:
age = remote_service.call_rpc('demo', 'getAge')
except Exception as e:
logging.error(e)
return str(e)
logging.info('got say hi request of %s who's age is %d' % (name, age))
return "Hi, %s who's age is %d!" % (name, age)
>>> server = Server()
>>> server.add_rpc_service('demo', DemoService())
>>> server.start()
call the service using jznet.js library
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
jznet-0.0.2-alpha2.tar.gz
(7.4 kB
view details)
File details
Details for the file jznet-0.0.2-alpha2.tar.gz.
File metadata
- Download URL: jznet-0.0.2-alpha2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab5d56e5a14b32f248c2020d3c3360e295820e654b4340020ac6ff691f9081eb
|
|
| MD5 |
e40514da8896b2a892b99a2a1482d646
|
|
| BLAKE2b-256 |
d8801cc77e8b7e548d7f19ac8883b63fa148ba8433a32fbd3eacddfeddd5429a
|