mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 10:48:51 +00:00
10308cb975
This closes #832
25 lines
623 B
Python
Executable File
25 lines
623 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
import time
|
|
from thrift.transport import TTransport
|
|
from thrift.transport import TSocket
|
|
from thrift.protocol import TBinaryProtocol
|
|
from thrift.server import THttpServer
|
|
from aggr import Aggr
|
|
|
|
|
|
class AggrHandler(Aggr.Iface):
|
|
def __init__(self):
|
|
self.values = []
|
|
|
|
def addValue(self, value):
|
|
self.values.append(value)
|
|
|
|
def getValues(self, ):
|
|
time.sleep(1)
|
|
return self.values
|
|
|
|
processor = Aggr.Processor(AggrHandler())
|
|
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
|
|
THttpServer.THttpServer(processor, ('', int(sys.argv[1])), pfactory).serve()
|