
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
aiothrift
Advanced tools
Asyncio implementation for thrift protocol, which is heavily based on thriftpy2_.
.. image:: https://travis-ci.org/ryanwang520/aiothrift.svg?branch=master :target: https://travis-ci.org/ryanwang520/aiothrift
Documentation: https://aiothrift.readthedocs.org/
::
$ pip install aiothrift
Thrift file ^^^^^^^^^^^
::
service PingPong {
string ping(),
i64 add(1:i32 a, 2:i64 b),
}
Server ^^^^^^
.. code:: python
import asyncio
import aiothrift
pingpong_thrift = aiothrift.load('pingpong.thrift', module_name='pingpong_thrift')
class Dispatcher:
def ping(self):
return "pong"
async def add(self, a, b):
await asyncio.sleep(1)
return a + b
async def main():
server = await aiothrift.create_server(pingpong_thrift.PingPong, Dispatcher()))
async with server:
await server.serve_forever()
asyncio.run(main())
Client ^^^^^^
.. code:: python
import asyncio
import aiothrift
pingpong_thrift = aiothrift.load('pingpong.thrift', module_name='pingpong_thrift')
async def go():
conn = await aiothrift.create_connection(pingpong_thrift.PingPong)
print(await conn.ping())
print(await conn.add(5, 6))
conn.close()
asyncio.run(go())
Or use ConnectionPool ^^^^^^^^^^^^^^^^^^^^^
.. code:: python
import asyncio
import aiothrift
pingpong_thrift = aiothrift.load('pingpong.thrift', module_name='pingpong_thrift')
async def go():
client = await aiothrift.create_pool(pingpong_thrift.PingPong)
print(await client.ping())
print(await client.add(5, 6))
client.close()
await client.wait_closed()
asyncio.run(go())
It's just that simple to begin with aiothrift, and you are not forced to use aiothrift on both server and client side.
So if you already have a normal thrift server setup, feel free to create an async thrift client to communicate with that server.
.. _async-timeout: https://pypi.python.org/pypi/async_timeout .. _thriftpy2: https://thriftpy2.readthedocs.org/en/latest/
aiothrift is offered under the MIT license.
FAQs
Async Thrift server and client
We found that aiothrift demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.