
This will greatly reduce the number of ksc to sdk differences. Why fight it, everyone is used to username anyway. Change-Id: Ie6e897c1baa3184af77510b98790196e8f069f5a
32 lines
881 B
ReStructuredText
32 lines
881 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 user_preference
|
|
|
|
# First, specify your preferences
|
|
pref = user_preference.UserPreference()
|
|
pref.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=pref, **auth_args)
|
|
|
|
# Finally, access your desired services
|
|
network = conn.network.find_network("matrix")
|
|
if network is None:
|
|
network = conn.network.create_network(name="matrix")
|