Created
November 2, 2011 00:51
-
-
Save joet3ch/1332511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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