Files
deb-python-openstacksdk/doc/source/users/guides/usage.rst
Brian Curtin e377e21ca0 More Pythonic Connection example usage
Change-Id: Ia0dd2a7264e663f4cdd7b5dd1c2a856599021564
2015-08-21 12:44:52 -05:00

845 B

Usage

To use openstacksdk in a project:

from openstack import connection
from openstack import profile

# First, specify your profile
prof = profile.Profile()
prof.set_region('network', 'zion')

# Second, create a connection
conn = connection.Connection(profile=prof,
                             auth_url='http://172.20.1.108:5000/v3',
                             project_name='hacker',
                             username='neo',
                             password='bluepill')

# Finally, access your desired services
network = conn.network.find_network("matrix")
if network is None:
    network = conn.network.create_network(name="matrix")