I am thinking that this code may be usable in the future for something like IOT solutions
#!/bin/env python
import base64
from thrift.protocol import TCompactProtocol
from thrift.TSerialization import deserialize
from foo.ttypes import FooObj
def main():
protocol_factory = TCompactProtocol.TCompactProtocolFactory
base64_string = ‘F9nO91PjpQtAAA==’
print ‘base64 string: ‘, base64_string
# deserialize the string back into an object
foo_blob = base64.urlsafe_b64decode(base64_string)
foo_obj = FooObj()
deserialize(foo_obj, foo_blob, protocol_factory=protocol_factory())
print ‘foo_obj.bar: ‘, foo_obj.bar