Skip to main content

A fully-featured and blazing-fast Python API client to interact with Algolia.

Project description

Algolia for Python

The perfect starting point to integrate Algolia within your Python project

PyPI Python versions License

DocumentationDjangoCommunity ForumStack OverflowReport a bugFAQSupport

✨ Features

  • Thin & minimal low-level HTTP client to interact with Algolia's API
  • Supports Python from 3.8 to 3.12

💡 Getting Started

First, install Algolia Python API Client via the pip package manager:

pip install --upgrade 'algoliasearch>=4.0,<5.0'

Now you can initialize any client with your Algolia credentials, for example the SearchClient:

from algoliasearch.search.client import SearchClient

client = SearchClient.create("YOUR_APP_ID", "YOUR_API_KEY")

Add new object to your index:

save_resp = await client.save_object(index_name="nvim", body={"description": "blazing fast"})

Wait for the task to be processed on the Algolia side

await client.wait_for_task(index_name="nvim", task_id=save_resp.task_id)

Finally, you may begin searching a object using the search method:

# using a raw dict

search_resp = await client.search(search_method_params={"requests": [{"indexName": "nvim"}]})

# using the given models

from algoliasearch.search.models.search_method_params import SearchMethodParams
from algoliasearch.search.models.search_for_hits import SearchForHits
from algoliasearch.search.models.search_query import SearchQuery

search_resp = await client.search(
    search_method_params=SearchMethodParams(
        requests=[
            SearchQuery(SearchForHits(index_name="nvim")),
        ],
    ),
)

print(search_resp.to_json())

For full documentation, visit the Algolia Python API Client.

❓ Troubleshooting

Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the client.

Use the Dockerfile

If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our dedicated guide to learn more.

📄 License

Algolia Python API Client is an open-sourced software licensed under the MIT license.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

algoliasearch-4.0.0b17.tar.gz (322.0 kB view hashes)

Uploaded Source

Built Distribution

algoliasearch-4.0.0b17-py3-none-any.whl (834.0 kB view hashes)

Uploaded Python 3

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