A simple thrift proxy in Python. Handy for intercepting and logging Thrift calls over the network.
- thrift
Kind of obvious, but you need the Python thrift package. You’ll also need the thrift compiler.
- docopt
Used for cli documentation. Truly the only way to do command line argument parsing
- Generate Thrift Python code
- The proxy uses the Python code generated by your thrift compiler, so you’ll need to generate that code.
- Add Generated code to sys.path
- This is a simple program that relies on Python’s import logic to find the thrift code, so you’l need to add it yourself.
- Start the Thrift service
- Spin up the “real” Thrift server you want to proxy.
- Start the proxy
- Follow the usage directions built in to the script.
python thriftproxy.py cql.cassandra.Cassandra.Client 9161 9160
- Done
- You can now hit the proxy as though it was the Thrift service