Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hhatto/aiogrn
asyncio Groonga Client library
https://github.com/hhatto/aiogrn
Last synced: about 1 month ago
JSON representation
asyncio Groonga Client library
- Host: GitHub
- URL: https://github.com/hhatto/aiogrn
- Owner: hhatto
- License: mit
- Created: 2016-10-27T12:53:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-20T07:58:48.000Z (over 6 years ago)
- Last Synced: 2024-09-14T03:27:08.891Z (2 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
aiogrn
======asyncio Groonga_ Client.
.. _Groonga: http://groonga.org/
Requirements
------------
* Python3.5+Usage
-----GQTP
~~~~.. code-block:: python
import asyncio
from aiogrn.client import GroongaClientasync 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
~~~~.. code-block:: python
import asyncio
from aiogrn.client import GroongaClientasync 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
-----
* PyPI_
* GitHub_.. _PyPI: https://pypi.python.org/pypi/aiogrn/
.. _GitHub: https://github.com/hhatto/aiogrn