Here are the examples of the python api thriftpy.protocol.TCyBinaryProtocolFactory taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
def main():
n = 100000
print("binary protocol struct benchmark for {} times:".format(n))
encode(n)
decode(n)
print("\ncybin protocol struct benchmark for {} times:".format(n))
encode(n, TCyBinaryProtocolFactory())
decode(n, TCyBinaryProtocolFactory())
3
Example 2
Project: thriftpy Source File: calc_client.py
def main():
with client_context(calc_thrift.Calculator, '127.0.0.1', 6000,
proto_factory=TCyBinaryProtocolFactory(),
trans_factory=TCyBufferedTransportFactory()) as cal:
a = cal.mult(5, 2)
b = cal.sub(7, 3)
c = cal.sub(6, 4)
d = cal.mult(b, 10)
e = cal.add(a, d)
f = cal.div(e, c)
print(f)
3
Example 3
Project: thriftpy Source File: calc_server.py
def main():
server = make_server(calc_thrift.Calculator, Dispatcher(),
'127.0.0.1', 6000,
proto_factory=TCyBinaryProtocolFactory(),
trans_factory=TCyBufferedTransportFactory())
print("serving...")
server.serve()