Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python
import sys
sys.path.append('/opt/tools/SomeApp/')
import SomeApp
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
def main():
# establish connection to SomeApp
try:
transport = TSocket.TSocket('service.SomeApp.com', '80')
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
SomeApp_link = SomeApp.Client(protocol)
transport.open()
except:
error_msg = 'Connect to SomeApp failed'
logError(error_msg)
# utilize the Thrift service (call method 'recordUserName')
recordUserName = SomeApp_link.recordUserName('joe')
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment