Skip to main content

PyDoof

Build Status

PyDoof is a Python client for Doofinder APIs (management and search). It provides easy access to Doofinder endpoint, including parameters-parsing and requests authentication.

Installation

PyDoof can be installed from PyPI:

pip install pydoof

Or directly from source code:

python setup.py install

Testing

Required package:

pip install parameterized

Using a package like pytest or tox:

pip install pytest

pytest

Or, directly with setup.py:

python setup.py test

Usage

To configure PyDoof, you need one of your user API keys, and your management and search URLs. You can find that information in the API Keys section of your Doofinder admin page. Set pydoof.token, pydoof.management_url, and pydoof.search_url with those values:

import pydoof
pydoof.token = "b8bcb..."
pydoof.management_url = "https://eu1-api.doofinder.com"
pydoof.search_url = "https://eu1-search.doofinder.com"

# Lists your search engines
search_engines = pydoof.search_engines.list()

# Search a term in one search engine
result = pydoof.search.query("abe16c8...", "some terms")

Per-request Configuration

You can configure individual requests via keywords arguments. For instance, setting a different token:

# List a search engine indices
pydoof.indices.list("abe16c8...", "product", token="cc83a..")

# Search suggestions for some terms
result = pydoof.search.suggest("cb12b...", "query", search_url = "https://eu1-search.doofinder.com")

Management and Search APIs

PyDoof includes clients for Doofinder management and search APIs. These two clients can work as separated modules. For instance, if you only want to use management API, you do not need to configure the pydoof.search_url parameter.

Management API

Management API allows you to handle search engines, indices and items. For instance, you can create an index for a search engine and index an item:

import pydoof
pydoof.token = "b8bcb..."
pydoof.management_url = "https://eu1-api.doofinder.com"

# Create an index
index = {
  "options": {
    "exclude_out_of_stock_items": False,
    "group_variants": False
  },
  "name": "product",
  "preset": "product"
}
pydoof.indices.create(hashid="abe16c8...", index=index)

# Index an item
item = {
  "categories": [
    "cat1",
    "cat2"
  ],
  "df_manual_boost": 1,
  "id": "1234",
  "link": "http://www.example.com/img/1234.png",
  "title": "Item Title"
}
pydoof.items.create(hashid="abe16c8...", name="product", item = item)

For a complete API reference, see the Management API docs.

Search API

Search API allows you to do queries to your search engines, and record data about your sales. For instance, you can search "cars" that are "blue" and with a price lower than €20.000.000.

import pydoof
pydoof.token = "b8bcb..."
pydoof.search_url = "https://eu1-search.doofinder.com"

# Search "cars" that are "blue" and with a price lower than €20.000.000
pydoof.search.query(
  hashid="abe16c8...",
  query="cars",
  filter={"color": "blue"},
  exclude={"price": {"gt": 20000000}}
)

And after that, record your sale:

# Add product to cart
pydoof.search_stats.add_to_cart(
  hashid="abe16c8...",
  index_name="product",
  session_id="4affa6",
  item_id="Ref001",
  amount=1,
  title="Ford Fiesta",
  price=8900.99
)

# And record that sale
pydoof.search_stats.log_checkout(hashid="abe16c8...", session_id="4affa6")

For a complete API reference, see the Search API docs.

Metadata

Release files for PyDoof 4.3.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 PyDoof 4.3.0
File Size Uploaded
pydoof-4.3.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyDoof 4.3.0
File Interpreter ABI Platform
pydoof-4.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / pydoof-4.3.0.tar.gz

Download URL pydoof-4.3.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
38defd744ef98a6d24624cc75cf06e8c006537675e6d0f721fac736e5cbab84e
BLAKE2b-256 checksum
How to use checksums
70e8cf1105427202fd6dfcd86ca235dfa7d8c22ac82917993770b392a44adace
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / pydoof-4.3.0-py3-none-any.whl

Download URL pydoof-4.3.0-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c313ac877d44a27e1a9c58597bf4a507184a04ca6771aafb4a2ff8eec351f4ea
BLAKE2b-256 checksum
How to use checksums
814bab65a2e238eba5512c02fa53c1865343c3f765d5a2262f7703f61dbb4263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

4.3.0 This release

2 release files

4.2.0

2 release files

4.1.0

2 release files

3.3.5

2 release files

3.3.4

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

1 release file

2.5.2

1 release file

2.5.0

1 release file

2.4.5

1 release file

2.4.4

1 release file

2.4.3

1 release file

2.4.2

1 release file

2.4.0

1 release file

2.3.1

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0

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