예제 #1
0
def main() :
    server = SimpleXMLRPCServer(("localhost", 2013), requestHandler=RequestHandler)
    server.register_introspection_functions()
    server.register_function(xmlrpc_save)
    server.register_instance(gender_for_apps.GenderForApps())
    try :
        print "Listing 2013"
        server.serve_forever()
    except KeyboardInterrupt :
        print "exit..."
예제 #2
0
파일: runner.py 프로젝트: zhaoweikid/zbase
def run_simple(app, port=8000, *args, **kwargs):
    from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
    from wsgiref.simple_server import make_server
    from SocketServer import ThreadingMixIn

    class ThreadingWSGIServer(ThreadingMixIn, WSGIServer):
        pass

    class FixedHandler(WSGIRequestHandler):
        def address_string(self): # Prevent reverse DNS lookups please.
            return self.client_address[0]

    server = make_server('', port, app, ThreadingWSGIServer, FixedHandler)
    server.set_app(app)
    log.info("Server running on port %d" % (port))
    server.serve_forever()
예제 #3
0
def run_simple(app, port=8000, *args, **kwargs):
    from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
    from wsgiref.simple_server import make_server
    from socketserver import ThreadingMixIn

    class ThreadingWSGIServer(ThreadingMixIn, WSGIServer):
        pass

    class FixedHandler(WSGIRequestHandler):
        def address_string(self):  # Prevent reverse DNS lookups please.
            return self.client_address[0]

    server = make_server('', port, app, ThreadingWSGIServer, FixedHandler)
    server.set_app(app)
    log.info("Server running on port %d" % (port))
    server.serve_forever()
예제 #4
0
    print("updating sign")
    return 'ok'

  def clearAll(self):
    dom = minidom.Document()
    infosys = dom.createElement('lilinfosys')
    dom.appendChild(infosys)
    saveDom(dom)
    return 'ok'

class InfosysXmlRpc(xmlrpc.XMLRPC):
  def xmlrpc_clearAll(self):
    return Methods.clearAll()

if __name__ == "__main__":
  from twisted.internet import reactor
  import xml.dom.minidom
  print "xmlrpcserver starting"
  if not os.path.exists( FILE ):
    print "Creating file " + FILE
    file = open (FILE, 'w')
    dom = xml.dom.minidom.Document()
    infosys_element = dom.createElementNS('http://infosys.csh.rit.edu/', 'lilinfosys')
    dom.appendChild(infosys_element)
    file.write(dom.toxml())
    file.close()
  methods_object = Methods()
  server = SimpleXMLRPCServer.SimpleXMLRPCServer(("0.0.0.0", PORT))
  server.register_instance(methods_object)
  server.serve_forever()