Skip to content

Instantly share code, notes, and snippets.

# So we can talk to the SoftLayer API:
import SoftLayer.API
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername =
import SoftLayer
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
records = [
{
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
import SoftLayer
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
def getImageTemplateId(templateName):
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
templates = client['Account'].getBlockDeviceTemplateGroups()
for template in templates:
import SoftLayer
apiUsername = ''
apiKey = ''
package = 46
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
categoryObjectMask = "mask[isRequired, itemCategory[id, name]]"
configurations = client['Product_Package'].getConfiguration(
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
templateId =
client = SoftLayer.API.Client('SoftLayer_Product_Order', None, apiUsername, apiKey)
#!/usr/bin/env python
"""
Generates graphs of VLANs and connected hardware/CCIs from data in the
SoftLayer API.
"""
import argparse
import time
try:
from pydot import Dot, Node, Edge
@sudorandom
sudorandom / softlayer_suds.py
Created December 12, 2013 03:27
Very primitive way to use suds with the SoftLayer API through SOAP
from suds.client import Client
from suds.xsd.doctor import Import, ImportDoctor
imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
imp.filter.add('http://api.service.softlayer.com/soap/v3/')
doctor = ImportDoctor(imp)
client = Client('https://api.softlayer.com/soap/v3/SoftLayer_Account?wsdl', doctor=doctor)
@sudorandom
sudorandom / import_stuff.py
Created March 5, 2014 23:56
Multi Multiple Import
PARSERS = [('pkg_resources', 'parse_version'), ('distutils.version', 'StrictVersion')]
def get_parse_fn():
for parser_module, parser in PARSERS:
try:
return getattr(importlib.import_module(parser_module), 'parser')
except ImportError:
pass
raise Exception("Couldn't find a thing to do the thing")