Source

yt.rife / simple_server.py

import Pyro4
import uuid
from yt.gui.reason.basic_repl import ProgrammaticREPL
from yt.gui.reason.bottle_mods import PayloadHandler

class Executor(object):
    def __init__(self):
        self.payload_handler = PayloadHandler()
        self.repl = ProgrammaticREPL()
    def execute(self, code):
        print "EXECUTING", code
        return self.repl.execute(code)
    def deliver(self):
        return self.payload_handler.deliver_payloads()

executor = Executor()

Pyro4.config.HMAC_KEY = uuid.uuid4().hex
print "HMAC KEY", Pyro4.config.HMAC_KEY
Pyro4.Daemon.serveSimple(
      {executor: "yt.executor"},
      ns=False)