Originally hosted at : https://github.com/erlepereira/thrift-experimentation (now deleted) Have pulled in inside here, owing to recent acquisition rumors ;) Date: 4 June 2018.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
841 B

#!/usr/bin/env python
import sys
sys.path.append('../gen-py')
from atmservice import atmService
from atmservice.ttypes import *
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ''
print 'Usage: ' + sys.argv[0] + ' <amount to withdraw>'
print ''
sys.exit(0)
amt = int(sys.argv[1])
try:
transport = TSocket.TSocket('localhost', 8082)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
user = atmService.Client(protocol)
transport.open()
user.active()
result = user.atmserve(amt)
print result
transport.close()
except Thrift.TException, tx:
print "%s" % (tx.message)