async def get_ipfs_api(timeout=60, reset=False): global API if API is None or reset: from aleph.web import app host = app['config'].ipfs.host.value port = app['config'].ipfs.port.value API = aioipfs.AsyncIPFS(host=host, port=port, read_timeout=timeout, conns_max=100) return API
async def get_ipfs_api(timeout=5, reset=False): global API if API is None or reset: from aleph.web import app host = app["config"].ipfs.host.value port = app["config"].ipfs.port.value API = aioipfs.AsyncIPFS( host=host, port=port, read_timeout=timeout, conns_max=25, conns_max_per_host=10, debug=(app["config"].logging.level.value <= logging.DEBUG)) return API
async def updateIpfsClient(self): from galacteek.ipfs import ConnectionError connParams = self.getIpfsConnectionParams() client = aioipfs.AsyncIPFS(host=connParams.host, port=connParams.apiPort, loop=self.loop) self.ipfsClient = client self.ipfsCtx.ipfsClient = client self.ipfsOpMain = self.getIpfsOperator() self.ipfsOpMain.ipidManager = self.ipidManager IPFSOpRegistry.regDefault(self.ipfsOpMain) try: await self.setupRepository() except ConnectionError: await messageBoxAsync( 'IPFS connection error (is your daemon running ?)') await self.ipfsCtx.ipfsConnectionReady.emit()
async def serve(topic): async with aioipfs.AsyncIPFS() as cli: async for message in cli.pubsub.sub(topic): print('Received message', message['data'], 'from', message['from']) d = await cli.pubsub.pub('othertopic', 'Cool')
async def ipfs_find_main(args): client = aioipfs.AsyncIPFS(host=args.apihost, port=args.apiport) await find(client, args) await client.close()
def localipfsclient(mockApp): client = aioipfs.AsyncIPFS(loop=mockApp.loop, host='127.0.0.1', port=5042) yield client
def iclient2(event_loop): return aioipfs.AsyncIPFS(port=apiport + 10, loop=event_loop)
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'])
def localipfsclient(event_loop): client = aioipfs.AsyncIPFS(loop=event_loop, host='127.0.0.1', port=5001) yield client
async def get_ipfs_api(timeout=60): from nulsexplorer.web import app host = app['config'].ipfs.host.value port = app['config'].ipfs.port.value return aioipfs.AsyncIPFS(host=host, port=port, read_timeout=timeout)
def client(self): return aioipfs.AsyncIPFS(host='127.0.0.1', port=self.apiport, loop=self.loop)
def get_client(self) -> aioipfs.AsyncIPFS: return aioipfs.AsyncIPFS(**self.aioipfs_config)