Package: python-searchlightclient
Team and repository tagspython-searchlightclientOpenStack Indexing and Search API Client LibraryThis is a client library for Searchlight built on the Searchlight API. It
provides a Python API (thesearchlightclientmodule) and a command-line
tool (searchlight).The project is hosted onStoryboard, where bugs can be filed. The code is
hosted onOpenStack git repository. Patches must be submitted usingGerrit,notgit repo
pull requests.python-searchlightclient is licensed under the Apache License like the rest of
OpenStack.Contents:Install the client from PyPISetup the client from sourceCommand-line APIPython APITestingInstall the client from PyPIThe programpython-searchlightclientpackage is published onPyPIand
so can be installed using the pip tool, which will manage installing all
python dependencies:$ pip install python-searchlightclientNoteThe packages on PyPI may lag behind the git repo in functionality.Setup the client from sourceClone repository for python-searchlightclient:$ git clone https://opendev.org/openstack/python-searchlightclient.git
$ cd python-searchlightclientSetup a virtualenvNoteThis is an optional step, but will allow Searchlightclient’s dependencies
to be installed in a contained environment that can be easily deleted
if you choose to start over or uninstall Searchlightclient.$ tox -evenv --notestActivate the virtual environment whenever you want to work in it.
All further commands in this section should be run with the venv active:$ source .tox/venv/bin/activateNoteWhen ALL steps are complete, deactivate the virtualenv: $ deactivateInstall Searchlightclient and its dependencies:(venv) $ python setup.py developCommand-line APISet Keystone environment variables to execute CLI commands against searchlight.To execute CLI commands:$ export OS_USERNAME=<user>
$ export OS_PASSWORD=<password>
$ export OS_TENANT_NAME=<project>
$ export OS_AUTH_URL='http://localhost:5000/v2.0/'NoteWith devstack you just need to $ source openrc <user> <project>. And you can
work with a local installation by passing –os-token <TOKEN> and –os-urlhttp://localhost:9393. You can also set up aOpenstackclientconfig file
to work with the CLI.$ openstack
(openstack) search resource type list
+--------------------------+--------------------------+
| Name                     | Type                     |
+--------------------------+--------------------------+
| OS::Designate::RecordSet | OS::Designate::RecordSet |
| OS::Designate::Zone      | OS::Designate::Zone      |
| OS::Glance::Image        | OS::Glance::Image        |
| OS::Glance::Metadef      | OS::Glance::Metadef      |
| OS::Nova::Server         | OS::Nova::Server         |
+--------------------------+--------------------------+Here are the full list of subcommands, Use -h to see options:SubcommandDescriptionsearch facet listList Searchlight Facetsearch resource type listList Searchlight Resource Type (Plugin)search querySearch Searchlight resourcePython APITo use with keystone as the authentication system:>>> from keystoneclient.auth.identity import generic
>>> from keystoneclient import session
>>> from searchlightclient import client
>>> auth = generic.Password(auth_url=OS_AUTH_URL, username=OS_USERNAME, password=OS_PASSWORD, tenant_name=OS_TENANT_NAME)
>>> keystone_session = session.Session(auth=auth)
>>> sc = client.Client('1', session=keystone_session)
>>> sc.resource_types.list()
[...]License: Apache License, Version 2.0Documentation:https://docs.openstack.org/developer/python-searchlightclientSource:https://opendev.org/openstack/python-searchlightclientBugs:https://storyboard.openstack.org/#!/project_group/searchlightTestingThere are multiple test targets that can be run to validate the code.tox -e pep8 - style guidelines enforcementtox -e py36 - traditional unit testing with python 3.6tox -e py37 - traditional unit testing with python 3.7