Created
March 19, 2012 21:53
-
-
Save davidmiller/2127419 to your computer and use it in GitHub Desktop.
Thrift Boilerplate Client code
This file contains hidden or 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
| from thrift.transport import TTransport | |
| from thrift.transport import TSocket | |
| from thrift.protocol import TBinaryProtocol | |
| import Service | |
| try: | |
| socket = TSocket.TSocket("localhost", 45678) | |
| transport = TTransport.TFramedTransport(socket) | |
| protocol = TBinaryProtocol.TBinaryProtocol(transport) | |
| client = Service.Client(protocol) | |
| transport.open() | |
| print client.ping() | |
| except: | |
| print "ERROR: ",sys.exc_info() | |
| finally: | |
| transport.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment