{"id":16367148,"url":"https://github.com/snower/torthrift","last_synced_at":"2025-07-03T22:35:44.904Z","repository":{"id":17864780,"uuid":"20796528","full_name":"snower/TorThrift","owner":"snower","description":"Thrift Tornado server","archived":false,"fork":false,"pushed_at":"2018-03-13T02:33:00.000Z","size":84,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-06T17:05:32.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"callstack-io/react-native-fbads","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snower.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-13T07:54:15.000Z","updated_at":"2023-07-28T14:24:28.000Z","dependencies_parsed_at":"2022-09-26T21:40:48.580Z","dependency_job_id":null,"html_url":"https://github.com/snower/TorThrift","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/snower/TorThrift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2FTorThrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2FTorThrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2FTorThrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2FTorThrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snower","download_url":"https://codeload.github.com/snower/TorThrift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2FTorThrift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263415861,"owners_count":23463106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T02:48:43.552Z","updated_at":"2025-07-03T22:35:44.864Z","avatar_url":"https://github.com/snower.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"TorThrift\n========\n\nTornado asynchronous thrift server and client\n\nAbout\n=====\n\ntorthrift - presents a Tornado Future-based API and greenlet for\nnon-blocking thrift server and client.\n\nInstallation\n============\n\n::\n\n    pip install TorThrift\n\nExamples\n========\n\nexample.thrift\n\n::\n\n    service Example{\n     i32 add(1:i32 a,2:i32 b)\n    }\n    \n::\n\n    thrift --gen py example.thrift\n    \nserver.py\n\n::\n\n    from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory\n    from torthrift.transport import TIOStreamTransportFactory\n    from torthrift.server import TTornadoServer\n    from example.Example import Processor\n    from tornado.ioloop import IOLoop\n    from tornado import gen\n    \n    class Handler(object):\n        @gen.coroutine\n        def add(self,a,b):\n            raise gen.Return(a+b)\n\n    handler = Handler()\n    processor = Processor(handler)\n    tfactory = TIOStreamTransportFactory()\n    protocol =TBinaryProtocolFactory()\n\n    server = TTornadoServer(processor, tfactory, protocol)\n    server.bind(20000)\n    server.start(0)\n    IOLoop.instance().start()\n        \nclient.py\n    \n::\n\n    from tornado.ioloop import IOLoop\n    from tornado import gen\n    from example.Example import Client\n    from thrift import Thrift\n    from torthrift.pool import TStreamPool\n    from thrift.protocol.TBinaryProtocol import TBinaryProtocolFactory\n    from torthrift.client import PoolClient\n    \n    @gen.coroutine\n    def test():\n        try:\n            transport = TStreamPool('127.0.0.1', 20000, max_stream=10)\n            client = PoolClient(Client, transport, TBinaryProtocolFactory())\n    \n            res = yield client.add(0,i)\n            print res\n            yield client.close()\n        except Thrift.TException as ex:\n            print(\"%s\" % (ex.message))\n        ioloop.stop()\n    \n    ioloop = IOLoop.instance()\n    ioloop.add_callback(test)\n    ioloop.start()","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnower%2Ftorthrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnower%2Ftorthrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnower%2Ftorthrift/lists"}