%global _empty_manifest_terminate_build 0 Name: python-PyDoof Version: 4.2.0 Release: 1 Summary: Doofinder's search & management API client License: MIT License URL: https://github.com/doofinder/pydoof Source0: https://mirrors.aliyun.com/pypi/web/packages/30/fb/2ce66950b64bb5f396dab775564211c685d20a3b55a4649e44eb3c53e4d8/PyDoof-4.2.0.tar.gz BuildArch: noarch Requires: python3-requests %description # PyDoof [![Build Status](https://api.travis-ci.org/doofinder/pydoof.svg?branch=master)](https://travis-ci.org/doofinder/pydoof) 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: ```shell pip install pydoof ``` Or directly from source code: ```shell python setup.py install ``` ## Testing Required package: ```shell pip install parameterized ``` Using a package like `pytest` or `tox`: ```shell pip install pytest pytest ``` Or, directly with `setup.py`: ```shell 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](https://app.doofinder.com/es/admin/api/) of your Doofinder admin page. Set `pydoof.token`, `pydoof.management_url`, and `pydoof.search_url` with those values: ```python 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: ```python # 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: ```python 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](https://docs.doofinder.com/api/management/v2/index.html). #### 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. ```python 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: ```python # 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](https://docs.doofinder.com/api/search/v6/index.html). %package -n python3-PyDoof Summary: Doofinder's search & management API client Provides: python-PyDoof BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-PyDoof # PyDoof [![Build Status](https://api.travis-ci.org/doofinder/pydoof.svg?branch=master)](https://travis-ci.org/doofinder/pydoof) 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: ```shell pip install pydoof ``` Or directly from source code: ```shell python setup.py install ``` ## Testing Required package: ```shell pip install parameterized ``` Using a package like `pytest` or `tox`: ```shell pip install pytest pytest ``` Or, directly with `setup.py`: ```shell 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](https://app.doofinder.com/es/admin/api/) of your Doofinder admin page. Set `pydoof.token`, `pydoof.management_url`, and `pydoof.search_url` with those values: ```python 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: ```python # 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: ```python 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](https://docs.doofinder.com/api/management/v2/index.html). #### 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. ```python 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: ```python # 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](https://docs.doofinder.com/api/search/v6/index.html). %package help Summary: Development documents and examples for PyDoof Provides: python3-PyDoof-doc %description help # PyDoof [![Build Status](https://api.travis-ci.org/doofinder/pydoof.svg?branch=master)](https://travis-ci.org/doofinder/pydoof) 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: ```shell pip install pydoof ``` Or directly from source code: ```shell python setup.py install ``` ## Testing Required package: ```shell pip install parameterized ``` Using a package like `pytest` or `tox`: ```shell pip install pytest pytest ``` Or, directly with `setup.py`: ```shell 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](https://app.doofinder.com/es/admin/api/) of your Doofinder admin page. Set `pydoof.token`, `pydoof.management_url`, and `pydoof.search_url` with those values: ```python 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: ```python # 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: ```python 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](https://docs.doofinder.com/api/management/v2/index.html). #### 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. ```python 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: ```python # 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](https://docs.doofinder.com/api/search/v6/index.html). %prep %autosetup -n PyDoof-4.2.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-PyDoof -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 4.2.0-1 - Package Spec generated