Skip to content

Fix code blocks formatting of The Solution section docs #1534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ The Solution
Using the python dictionary's `.get() <https://docs.python.org/3/library/stdtypes.html#dict.get>`_ is great for non-nested items.

::

print("{}, {}".format(item.get('id'), item.get('hostName')))

Otherwise, this SDK provides a util function to do something similar. Each additional argument passed into `utils.lookup` will go one level deeper into the nested dictionary to find the item requested, returning `None` if a KeyError shows up.

::

itemId = SoftLayer.utils.lookup(item, 'id')
itemHostname = SoftLayer.utils.lookup(item, 'hostName')
print("{}, {}".format(itemId, itemHostname))
Expand Down