OpenStack Service Types Authority Client

1.8.2 · active · verified Sat Apr 11

Python library for consuming OpenStack sevice-types-authority data. It provides easy consumption of official OpenStack service types and their historical aliases, including a built-in version of the data for offline use. Current version is 1.8.2. Being an OpenStack project, its releases typically align with OpenStack development cycles.

Warnings

Install

Imports

Quickstart

The primary class is `ServiceTypes`, which can be initialized without arguments to use embedded service type data or with a `session` object (e.g., `requests.Session`) to fetch the latest data remotely. After initialization, you can query for service data, aliases, and check service type properties.

from os_service_types import ServiceTypes

# Initialize with built-in data (no network access required)
service_types = ServiceTypes()

# Get data for an official service type
compute_service = service_types.get_official_service_data("compute")

if compute_service:
    print(f"Official compute service name: {compute_service.name}")
    print(f"Compute project: {compute_service.project}")
    print(f"Aliases for compute: {service_types.get_aliases('compute')}")
else:
    print("Compute service not found in built-in data.")

# Check if a type is an alias
if service_types.is_alias("nova"): # 'nova' is an alias for 'compute'
    print("'nova' is an alias.")

# To fetch remote data, pass a requests.Session or keystoneauth1.session.Session instance:
# import requests
# session = requests.Session()
# remote_service_types = ServiceTypes(session=session)
# remote_image_service = remote_service_types.get_official_service_data("image")
# if remote_image_service:
#     print(f"Remote image service name: {remote_image_service.name}")

view raw JSON →