Skip to content

Instantly share code, notes, and snippets.

@davidmiller
Created March 19, 2012 21:53
Show Gist options
  • Select an option

  • Save davidmiller/2127419 to your computer and use it in GitHub Desktop.

Select an option

Save davidmiller/2127419 to your computer and use it in GitHub Desktop.
Thrift Boilerplate Client code
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