-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_sever.py
44 lines (32 loc) · 937 Bytes
/
example_sever.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2019/8/4
Description:
example.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()