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.
pip install os-service-typesVerified import paths — ran on the pinned version, not inferred.
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.
Handle `IOError` or `ValueError` for remote fetching, or omit `only_remote=True` to allow fallback to built-in data. Ensure a valid `session` is passed if `only_remote=True`.
Set `warn=True` during initialization (`ServiceTypes(warn=True)`) to enable these warnings and monitor console/logs for non-official type usage.
Always use the official service types where possible. Refer to `service_types.get_official_service_data()` to ensure you are using the correct primary service type. Understand that aliases are for historical compatibility, not active development of new type names.
Initialize ServiceTypes with a valid session object (e.g., from `requests` or `keystoneauth1`) when `only_remote` is `True`, or omit `only_remote=True` to use the built-in data. Example: `from os_service_types import ServiceTypes; from requests import Session; services = ServiceTypes(session=Session(), only_remote=True)` or `services = ServiceTypes()`.
Ensure network connectivity and verify the accessibility of the remote OpenStack Service Types Authority. If remote fetching is not critical, remove `only_remote=True` from the `ServiceTypes` constructor to allow the library to fall back to its built-in data.
Install the package using pip: `pip install os-service-types`. Ensure your import statement is `from os_service_types import ServiceTypes`.
Attempt to upgrade `os-service-types` and its dependencies: `pip install --upgrade os-service-types`. If conflicts persist, consider creating a new virtual environment or manually identifying and installing compatible versions of `pbr` and other conflicting packages.