Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Created September 30, 2013 16:05
Show Gist options
  • Save underscorephil/6766068 to your computer and use it in GitHub Desktop.
Save underscorephil/6766068 to your computer and use it in GitHub Desktop.
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
client = SoftLayer.Client(
username=apiUsername,
api_key=apiKey,
)
# Retrieve all requests and their status
object_mask = 'mask.status'
result = client['Account'].getSecurityScanRequests(mask=object_mask)
pp(result)
# Retrieve a list of requests and pull their object/status individually
requests = client['Account'].getSecurityScanRequests(mask='mask.id')
for request in requests:
request_object = client['SoftLayer_Network_Security_Scanner_Request'].getObject(id=request['id'], mask=object_mask)
pp(request_object)
# Retrieve a list of requests and run getReport on each
requests = client['Account'].getSecurityScanRequests(mask='mask.id')
for request in requests:
report = client['SoftLayer_Network_Security_Scanner_Request'].getReport(id=request['id'])
pp(report)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment