Cloud Skyline

Skyline Insights API – How to get Results using Python

In the past, we have shown you how to leverage Skyline Insights API using Curl with shell scripting and Powershell.  Here let’s look at the same task using Python.  The formula is still the same.  You will need to use your API token to get your Access Token. Then you can query Skyline for the desired results.  The only difference here is syntax.  Let’s look at this together. 

For all python code you need the basic structure.  Here it is. 

In our case, we need to add an additional section to suppress insecure request warning.  It looks like this. We can drop these lines after the “import” section and before the “def main()” section. 

Now that we have the basic structure defined, let’s look at the actual Skyline Insights API tasks. First, get the Access Token using the API Token.  In order to do so, we need to contact console.cloud.vmware.com using this: 

Now that you have your Access Token, we can start to get the Findings detail for your organization.  We will now go directly to skyline.vmware.com to get the data.  Your json file may vary based on what you want to display.  I have added the “pretty” section so that the displayed results can be easily read. 

To put all of this together, the entire code will look like this.  

I hope this helps you use the Skyline Insights API with Python.  Please feel free to review other blog posts and convert them from Curl or Powershell over to Python.  We will continue to post more blogs to help you do more with less. 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *