Skip to content

hhatto/aiogrn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aiogrn

asyncio Groonga Client.

Requirements

  • Python3.5+

Usage

GQTP

import asyncio
from aiogrn.client import GroongaClient

async def fetch(grn, cmd, **kwargs):
    ret = await grn.call(cmd, **kwargs)
    print(ret)

loop = asyncio.get_event_loop()
grn = GroongaClient(host='localhost', port=10043, protocol='gqtp', loop=loop)
tasks = [
        asyncio.ensure_future(fetch(grn, 'status')),
        asyncio.ensure_future(fetch(grn, 'select', table='Foo')),
        asyncio.ensure_future(fetch(grn, 'status'))]
loop.run_until_complete(asyncio.gather(*tasks))
loop.close()

HTTP

import asyncio
from aiogrn.client import GroongaClient

async def fetch(grn, cmd, **kwargs):
    ret = await grn.call(cmd, **kwargs)
    print(ret)

loop = asyncio.get_event_loop()
grn = GroongaClient(loop=loop)
tasks = [
        asyncio.ensure_future(fetch(grn, 'status')),
        asyncio.ensure_future(fetch(grn, 'select', table='Foo')),
        asyncio.ensure_future(fetch(grn, 'status'))]
loop.run_until_complete(asyncio.gather(*tasks))
loop.close()

Links

About

asyncio Groonga Client library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages