Skip to main content
Asonic implements all Sonic APIs
Bugfixes and api changes are welcome

Install

pip install asonic

API Docs

here

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())

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asonic-2.0.0.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file asonic-2.0.0.tar.gz.

File metadata

  • Download URL: asonic-2.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for asonic-2.0.0.tar.gz
Algorithm Hash digest
SHA256 730f4f9380d0047e3c440dddd02eb793657686c890a8dc756d0237af49e1922f
MD5 13fa972096efb472fd3ff471bcd94cb8
BLAKE2b-256 44f74163715e4156e7be7e7e0712011869c634ee682203e25ed42df62f6d69a1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page