Files
deb-python-openstacksdk/doc/source/users/guides/usage.rst
Everett Toews 409f1683c4 Rename userguides to guides
Considering the path to the guides is doc/source/users/userguides,
the extra user in userguides looks weird and unnecessary.

Change-Id: I57c94907e150de2d9de28ed8073e20b494203c97
2015-08-20 10:55:41 -05:00

32 lines
851 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 profile
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(profile=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")