Skip to main content

OpenStack Indexing and Search API Client Library

Project description

Team and repository tags

https://governance.openstack.org/tc/badges/python-searchlightclient.svg

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://git.openstack.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()
[...]

Testing

There are multiple test targets that can be run to validate the code.

  • tox -e pep8 - style guidelines enforcement

  • tox -e py27 - traditional unit testing with python 2.7

  • tox -e py35 - traditional unit testing with python 3.5

  • tox -e py36 - traditional unit testing with python 3.6

  • tox -e py37 - traditional unit testing with python 3.7

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-searchlightclient-1.5.0.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_searchlightclient-1.5.0-py2.py3-none-any.whl (45.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python-searchlightclient-1.5.0.tar.gz.

File metadata

  • Download URL: python-searchlightclient-1.5.0.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/20.7.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for python-searchlightclient-1.5.0.tar.gz
Algorithm Hash digest
SHA256 0608a76fb5467b7582210e38ce5cc84a0e34b99746be06a7a728b44f32d76592
MD5 afbed85549c735dcfea21fadc4cf4bfe
BLAKE2b-256 3f7037b51f1d9e16120f70bf1bd2528d087f39778a6a7a56eba7b24316290479

See more details on using hashes here.

File details

Details for the file python_searchlightclient-1.5.0-py2.py3-none-any.whl.

File metadata

  • Download URL: python_searchlightclient-1.5.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/20.7.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2

File hashes

Hashes for python_searchlightclient-1.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0e209d6818a3e9c5001cdd4e0c019f0cebc17c511734a19058366196060da98e
MD5 53c808655585872c688c4e0d0a13d1ae
BLAKE2b-256 3b8da850703176f0119d1ef4ed2a7eeb73dc67274ef0e92ed5eb3a4a806fad0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page