OpenStack Indexing and Search API Client Library
Project description
python-searchlightclient
OpenStack Indexing and Search API Client Library
This is a client library for Searchlight built on the Searchlight API. It provides a Python API (the searchlightclient module) and a command-line tool (searchlight).
The project is hosted on Storyboard, where bugs can be filed. The code is hosted on OpenStack git repository. Patches must be submitted using Gerrit, not git repo pull requests.
python-searchlightclient is licensed under the Apache License like the rest of OpenStack.
Install the client from PyPI
The program python-searchlightclient package is published on PyPI and so can be installed using the pip tool, which will manage installing all python dependencies:
$ pip install python-searchlightclient
Setup the client from source
Clone repository for python-searchlightclient:
$ git clone https://opendev.org/openstack/python-searchlightclient.git $ cd python-searchlightclient
Setup a virtualenv
$ tox -evenv --notest
Activate 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/activate
Install Searchlightclient and its dependencies:
(venv) $ python setup.py develop
Command-line API
Set 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/'
$ 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:
Subcommand
Description
search facet list
List Searchlight Facet
search resource type list
List Searchlight Resource Type (Plugin)
search query
Search Searchlight resource
Python API
To 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.0
Documentation: https://docs.openstack.org/developer/python-searchlightclient
Source: https://opendev.org/openstack/python-searchlightclient
Bugs: https://storyboard.openstack.org/#!/project_group/searchlight
Testing
There are multiple test targets that can be run to validate the code.
tox -e pep8 - style guidelines enforcement
tox -e py36 - traditional unit testing with python 3.6
tox -e py37 - traditional unit testing with python 3.7
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
Built Distribution
Hashes for python-searchlightclient-2.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f68801431d0bf444e7aeaa8376213ecd2870adbd63136c622145ce5c1bdae4e |
|
MD5 | 6baa209a7c3d0eb8c1761ab9a609e124 |
|
BLAKE2b-256 | 17226f2329f04ae4c6bdf947d6ca73c22e5a24d629dcf754387ee7227df8a217 |
Hashes for python_searchlightclient-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 552a655324210bdb0744f67c263a37b5ac431fa3be32d598a423bd106732961c |
|
MD5 | b50a229ea97841f2cd36526ec1cd41c2 |
|
BLAKE2b-256 | d0bae9e47d8b5a633e40719f9a0a6b8a63f7822ceb797bd8d19f928fa888b484 |