Fix the example on the Usage page

Change-Id: I16354fefd09e0eec231164d6a4c6d8abf53e6aa4
This commit is contained in:
Everett Toews 2015-02-05 12:19:29 -06:00
parent 93417a52d7
commit 3182212674

View File

@ -6,9 +6,11 @@ To use python-openstacksdk in a project::
from openstack import connection from openstack import connection
from openstack import user_preference from openstack import user_preference
# First, specify your preferences # First, specify your preferences
pref = user_preference.UserPreference() pref = user_preference.UserPreference()
pref.set_region('network', 'zion') pref.set_region('network', 'zion')
# Second, create your authorization arguments # Second, create your authorization arguments
auth_args = { auth_args = {
'auth_url': 'http://172.20.1.108:5000/v3', 'auth_url': 'http://172.20.1.108:5000/v3',
@ -16,9 +18,11 @@ To use python-openstacksdk in a project::
'user_name': 'neo', 'user_name': 'neo',
'password': 'bluepill', 'password': 'bluepill',
} }
# Third, create a connection # Third, create a connection
conn = connection.Connection(preference=pref, **auth_args) conn = connection.Connection(preference=pref, **auth_args)
# Finally, access your desired services # Finally, access your desired services
network = conn.network.find_network("matrix") network = conn.network.find_network("matrix")
if network is None: if network is None:
network = conn.network.create_network({"name": "matrix"}) network = conn.network.create_network(name="matrix")