Search API Client for Python

Features

  • Gives API access to all Algolia functionality, settings, advanced features, and ML/AI products
  • Asynchronous methods built on top of Asyncio
  • Background retry strategy to ensure uptime
  • Seamless batching via iterators to optimize number of network calls
  • Zero downtime reindexing feature
  • Thin & minimal low-level HTTP client to interact with Algolia's API
  • Fully “pythonic”, follows modern Python while supporting Python 2

Version

  • Supports Python: 2.7, 3.4, 3.5, 3.6, 3.7, 3.8

Related Integrations

  • Django
  • InstantSearch for React, Vue, Angular, vanilla 
  • Autocomplete

Key links


Get started

INSTALL

1npm install algoliasearch

INDEX

1const objects = [{
2  firstname: 'Jimmie',
3  lastname: 'Barninger',
4  objectID: 'myID1'
5}, {
6  firstname: 'Warren',
7  lastname: 'Speach',
8  objectID: 'myID2'
9}];
10
11index.saveObjects(objects).then(({ objectIDs }) => {
12  console.log(objectIDs);
13});

SEARCH

1const client = algoliasearch('undefined', 'undefined');
2const index = client.initIndex('indexName');
3
4// only query string
5index.search('query string').then(({ hits }) => {
6  console.log(hits);
7});
8
9// with params
10index.search('query string', {
11  attributesToRetrieve: ['firstname', 'lastname'],
12  hitsPerPage: 50,
13}).then(({ hits }) => {
14  console.log(hits);
15});

Built with Python on Algolia