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
| import time from pickle import dumps from pprint import pprint
from ctpspot_client import get_static_data from rpyc import Service from rpyc.utils.server import ThreadedServer
from get_server_ip import get_host_ip
static_data = get_static_data() pkl_static_data = dumps(static_data)
class TimeService(Service): def exposed_get_time(self): return time.ctime()
def exposed_get_static_data(self): return pkl_static_data
if __name__ == "__main__": host_ip = get_host_ip() pprint(host_ip)
s = ThreadedServer(service=TimeService, port=15001, auto_register=False) s.start()
|