Files
deb-python-openstacksdk/doc/source/users/userguides/usage.rst
Brian Curtin 7fc1888d19 Move from UserPreference to Profile
This is just a big name swap to move away from UserPreference to Profile
so it can be properly referenced in the summit talk. See #1435953

Change-Id: Iaa45fce0c8aacc9315070f8525a13f2e43f05a9e
Closes-Bug: 1435953
2015-05-20 14:58:24 +00:00

32 lines
858 B
ReStructuredText

.. TODO(briancurtin): turn this into a full guide on the Connection class
.. TODO(briancurtin): cover user_agent setting
=====
Usage
=====
To use python-openstacksdk in a project::
from openstack import connection
from openstack import profile
# First, specify your preferences
prof = profile.Profile()
prof.set_region('network', 'zion')
# Second, create your authorization arguments
auth_args = {
'auth_url': 'http://172.20.1.108:5000/v3',
'project_name': 'hacker',
'username': 'neo',
'password': 'bluepill',
}
# Third, create a connection
conn = connection.Connection(preference=prof, **auth_args)
# Finally, access your desired services
network = conn.network.find_network("matrix")
if network is None:
network = conn.network.create_network(name="matrix")