hits.entrezgene = item["entrezgene"] hits.name = item["name"] hits._score = item["_score"] hits.symbol = item["symbol"] hits._id = item["_id"] hits.taxid = item["taxid"] hits_list.append(hits) work.hits = hits_list work.max_score = {"max_score": 386.08304} work.took = {"took": 5} work.total = {"total": 26} print "process a request " return work handler = GeneHandler() processor = Gene.Processor(handler) transport = TSocket.TServerSocket(port=9090) tfactory = TTransport.TBufferedTransportFactory() pfactory = TBinaryProtocol.TBinaryProtocolFactory() server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) # You could do one of these for a multithreaded server #server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) #server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory) print 'Starting the server...' server.serve() print 'done.'