import Pyro4 @Pyro4.expose class GreetingMaker(object): def get_fortune(self, name): return "Hello, {0}. Here is your fortune message:\n" "Behold the warranty -- the bold print giveth and the fine print taketh away.".format(name) daemon = Pyro4.Daemon() uri = daemon.register(GreetingMaker) print("Ready. Object uri =", uri) daemon.requestLoop()
import Pyro4 uri = "PYRO:obj_48374051403c4cf28d59a344362c66ad@localhost:54811" name = "sdfsd" greeting_maker = Pyro4.Proxy(uri) # get a Pyro proxy to the greeting object print(greeting_maker.get_fortune(name)) # call method normally