Asonic implements all
Sonic APIs
Bugfixes and api changes are welcome
Install
pip install asonic
API Docs
Usage
Search channel
import asyncio
from asonic import Client
from asonic.enums import Channels
async def main():
c = Client(host='127.0.0.1', port=1491, password='SecretPassword', max_connections=100)
await c.channel(Channels.SEARCH)
assert (await c.query('collection', 'bucket', 'quick')) == [b'user_id']
assert (await c.suggest('collection', 'bucket', 'br', 1)) == [b'brown']
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Ingest channel
import asyncio
from asonic import Client
from asonic.enums import Channel
async def main():
c = Client(host='127.0.0.1', port=1491)
await c.channel(Channel.INGEST)
await c.push('collection', 'bucket', 'user_id', 'The quick brown fox jumps over the lazy dog')
# Return b'OK'
await c.pop('collection', 'bucket', 'user_id', 'The')
# Return 1
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Control channel
import asyncio
from asonic import Client
from asonic.enums import Channel, Action
async def main():
c = Client(host='127.0.0.1', port=1491)
await c.channel(Channel.CONTROL)
await c.trigger(Action.CONSOLIDATE)
# Return b'OK'
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Metadata
Release files for asonic 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asonic-2.0.0.tar.gz | 5.0 kB | Details |
Release files / asonic-2.0.0.tar.gz
| Download URL | asonic-2.0.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
730f4f9380d0047e3c440dddd02eb793657686c890a8dc756d0237af49e1922f
|
|
BLAKE2b-256 checksum How to use checksums |
44f74163715e4156e7be7e7e0712011869c634ee682203e25ed42df62f6d69a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|