Asynchronous IPFS client library
Project description
- info:
Asynchronous IPFS client library
The aioipfs Python package provides an asynchronous API for IPFS, using Python 3.5’s async/await mechanism.
Installation
pip install aioipfs
Usage examples
Get an IPFS resource
import sys
import asyncio
import aioipfs
async def get(ipfshash):
client = aioipfs.AsyncIPFS()
await client.get(ipfshash)
await client.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(get(sys.argv[1]))
loop.close()
Pubsub service
async def pubsub_serve(topic):
async with aioipfs.AsyncIPFS() as cli:
async for message in cli.pubsub.sub(topic):
print('Received message from', message['from'])
await cli.pubsub.pub(topic, message['data'])
Features
Async file writing on get operations
The aiofiles library is used to asynchronously write data retrieved from the IPFS daemon when using the /api/v0/get API call, to avoid blocking the event loop. TAR extraction is done in asyncio’s threadpool.
Requirements
Python >= 3.5.3
License
aioipfs is offered under the GNU GPL3 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioipfs-0.3.1.tar.gz
(15.7 kB
view hashes)
Built Distribution
aioipfs-0.3.1-py3-none-any.whl
(13.1 kB
view hashes)