Debian Codegraph @

doc/source/library/index.rst

raw
1 =====
2 Usage
3 =====
4
5 The most basic use of `os-service-types` in a project:
6
7 .. code-block:: python
8
9 import os_service_types
10
11 service_types = os_service_types.ServiceTypes()
12
13 However, `os-service-types` expects to be able to fetch remote data, so it's
14 better to pass in a ``Session`` object. Both
15 :class:`requests.sessions.Session` and
16 :class:`keystoneauth1.session.Session` objects are supported. A
17 :class:`keystoneauth1.session.Session` object does not need auth information
18 attached, although it will not break anything if it does.
19
20 .. code-block:: python
21
22 import keystoneauth1.session
23 import os_service_types
24
25 session = keystoneauth1.session.Session()
26 service_types = os_service_types.ServiceTypes(session=session)