Skip to main content

python-sonic-client

Python client for sonic search backend.

Install

pip install sonic-client

Examples

Ingest

from sonic import IngestClient

with IngestClient("127.0.0.1", 1491, "password") as ingestcl:
    print(ingestcl.ping())
    print(ingestcl.protocol)
    print(ingestcl.bufsize)
    ingestcl.push("wiki", "articles", "article-1", "for the love of god hell")
    ingestcl.push("wiki", "articles", "article-2", "for the love of satan heaven")
    ingestcl.push("wiki", "articles", "article-3", "for the love of lorde hello")
    ingestcl.push("wiki", "articles", "article-4", "for the god of loaf helmet")

Search

from sonic import SearchClient

with SearchClient("127.0.0.1", 1491, "password") as querycl:
    print(querycl.ping())
    print(querycl.query("wiki", "articles", "for"))
    print(querycl.query("wiki", "articles", "love"))
    print(querycl.suggest("wiki", "articles", "hell"))

Control

from sonic import ControlClient

with ControlClient("127.0.0.1", 1491, "password") as controlcl:
    print(controlcl.ping())
    controlcl.trigger("consolidate")

API reference

API documentation can be found at docs/api and also Browsable

Difference from asonic

asonic uses asyncio and this client doesn't. It grew out of needing to use sonic within gevent context

Metadata

Release files for sonic-client 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sonic-client 1.0.0
File Size Uploaded
sonic-client-1.0.0.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sonic-client 1.0.0
File Interpreter ABI Platform
sonic_client-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.1 kB

Release files / sonic-client-1.0.0.tar.gz

Download URL sonic-client-1.0.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fe324c7354670488ed84847f6a6727d3cb5fb3675cb9b61396dcf5720e5aca66
BLAKE2b-256 checksum
How to use checksums
29475c356456e5dc3ba3f52d88a6b4d0661bdbe44a6a2340b3ca04005504c8ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / sonic_client-1.0.0-py3-none-any.whl

Download URL sonic_client-1.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
291bf292861e97a2dd765ff0c8754ea9631383680d31a63ec3da6f5aa5f4beda
BLAKE2b-256 checksum
How to use checksums
9d12e98f8533a5c5b28271be79b38e0648a69e4068907568a435276532bb2871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release 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