Skip to main content

The python async client for MeiliSearch API.

Project description

ameiliSearch

Asynchronous MeiliSearch API client that is 100% compatible with MeiliSearch Python

upstream commit hash: e665923efc9735fd09994b0f01395ceb29051c71

Getting Started

Add Documents

import asyncio
import ameilisearch


async def main():
    documents = [
        { 'id': 1, 'title': 'Carol', 'genres': ['Romance', 'Drama'] },
        { 'id': 2, 'title': 'Wonder Woman', 'genres': ['Action', 'Adventure'] },
        { 'id': 3, 'title': 'Life of Pi', 'genres': ['Adventure', 'Drama'] },
        { 'id': 4, 'title': 'Mad Max: Fury Road', 'genres': ['Adventure', 'Science Fiction'] },
        { 'id': 5, 'title': 'Moana', 'genres': ['Fantasy', 'Action']},
        { 'id': 6, 'title': 'Philadelphia', 'genres': ['Drama'] },
    ]

    async with ameilisearch.Client("http://127.0.0.1:7700", 'masterKey') as client:
        async with client.index("movies") as index:
            # If the index 'movies' does not exist, MeiliSearch creates it when you first add the documents.
            await index.add_documents(documents) # => { "updateId": 0 }

asyncio.get_event_loop().run_until_complete(main())

Differences from synchronous clients

Existing API clients worked with requests.

ameilisearch works with aiohttp.

Users need to manage client sessions.

The http instance is in two places: Client and Index.

Use the async with syntax to close the session immediately after use, or must close the session using await :client_or_index_instance:.http.session.close() after using it all.

Project details


Download files

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

Source Distribution

ameilisearch-0.3.4.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

ameilisearch-0.3.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ameilisearch-0.3.4.tar.gz.

File metadata

  • Download URL: ameilisearch-0.3.4.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for ameilisearch-0.3.4.tar.gz
Algorithm Hash digest
SHA256 156c3b538815b2e4f3ffbb7a4b700b443922347412dd41cca3bee7229889847f
MD5 5052d31243231a989c97eb5ba47b372a
BLAKE2b-256 ba5727f8338fb084f3086171847dba64c66b6cfb70c7b2cc83b4afc078830da9

See more details on using hashes here.

File details

Details for the file ameilisearch-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: ameilisearch-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for ameilisearch-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f62a2a4470b20ffe4e40666a0f606f769b0b041c4b184f0da08e1e61a3a4365f
MD5 111976c58f9e1a624c9627483e7888dc
BLAKE2b-256 f1fd9f4be7bf75841bc4830afbaeba6c72f4d5e5039207a2cb202ae7094a06b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page