November 23, 2017

Classes SoftLayer_Account
Tags quotes

Retrieve an account's quote information.

This script retrieves the data presented in the SoftLayer Customer Portal's
( using an API call to SoftLayer_Account::getQuotes method.
Important manual pages:
@Author: SoftLayer Technologies, Inc. <>
# So we can talk to the SoftLayer API:
import SoftLayer

# For nice output:
from prettytable import PrettyTable
Your SoftLayer API username and key.
Generate an API key at the SoftLayer Customer Portal
API_USERNAME = 'set-me'
API_KEY = 'set-me'

# Create a client instance
client = SoftLayer.Client(username=API_USERNAME, api_key=API_KEY)

# Get the quotes available in the account.
    quotes = client['Account'].getQuotes()
except SoftLayer.SoftLayerAPIError as e:
    print("Error getting quote information, faultCode=%s, faultString=%s"
          % (e.faultCode, e.faultString))

table = []
# Let's to iterate through the list of quotes to get the details of each one.
for quote in quotes:
    table.append([quote['id'], quote['name'], quote['quoteKey'], quote['status'], quote['completedPurchaseDataId'],
                  quote['createDate'], quote['expirationDate'], quote['modifyDate']])

quoteDetail = PrettyTable(
    ["ID", "Name", "Quote Key", "Status", "Completed Purchase Data Id", "Create Date", "Expiration Date",
     "Modify Date"])
quoteDetail.align["ID"] = "l"
quoteDetail.padding_width = 1
for row in table:
    quoteDetail.add_row([row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7]])


We would love to hear it
Open an issue