File: index.rst

package info (click to toggle)
python-os-service-types 1.7.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 300 kB
  • sloc: python: 551; makefile: 20
file content (26 lines) | stat: -rw-r--r-- 741 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
=====
Usage
=====

The most basic use of `os-service-types` in a project:

.. code-block:: python

    import os_service_types

    service_types = os_service_types.ServiceTypes()

However, `os-service-types` expects to be able to fetch remote data, so it's
better to pass in a ``Session`` object. Both
:class:`requests.sessions.Session` and
:class:`keystoneauth1.session.Session` objects are supported. A
:class:`keystoneauth1.session.Session` object does not need auth information
attached, although it will not break anything if it does.

.. code-block:: python

    import keystoneauth1.session
    import os_service_types

    session = keystoneauth1.session.Session()
    service_types = os_service_types.ServiceTypes(session=session)