blob: a64b8d70791cc7ebdf46c9a8c95edc1093e0bd19 [file] [log] [blame]
Mark Sleefc89d392006-09-04 00:04:39 +00001#!/usr/bin/python
2
3import sys
4sys.path.append('./gen-py')
5
6import ThriftTest
7from ThriftTest_types import *
8from thrift.transport import TSocket
9from thrift.protocol import TBinaryProtocol
10
11transport = TSocket.TSocket('localhost', 9090)
12protocol = TBinaryProtocol.TBinaryProtocol()
13client = ThriftTest.Client(transport, protocol)
14
15transport.open()
16
17print "testVoid()"
18print client.testVoid()
19
20print "testString('PythonTest')"
21print client.testString('PythonTest')
22
23print "testByte(63)"
24print client.testByte(63)
25
26print "testException('Safe')"
27print client.testException('Safe')
28
29print "textException('Xception')"
30try:
31 print client.testException('Xception')
32except Xception, x:
33 print 'Xception (%d, %s)' % (x.errorCode, x.message)
34
35transport.close()