<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Code on myvirtualcloud.net</title><link>https://myvirtualcloud.net/tags/code/</link><description>Recent content in Code on myvirtualcloud.net</description><generator>Hugo</generator><language>en-us</language><copyright>Andre Leibovici</copyright><lastBuildDate>Thu, 14 Jul 2016 17:07:16 +0000</lastBuildDate><atom:link href="https://myvirtualcloud.net/tags/code/index.xml" rel="self" type="application/rss+xml"/><item><title>How to use Python with Nutanix REST API – Part 3</title><link>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-3/</link><pubDate>Thu, 14 Jul 2016 17:07:16 +0000</pubDate><guid>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-3/</guid><description>&lt;p&gt;This is the 3rd part of my brief tutorial on how to use Python with Nutanix REST API. In case you missed, &lt;a href="https://myvirtualcloud.net/?p=8176" target="_blank"&gt;How to use Python with Nutanix REST API – Part 1&lt;/a&gt; and &lt;a href="https://myvirtualcloud.net/?p=8215" target="_blank"&gt;Part 2&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Picking up from I left off in the 2nd part… When retrieving data from Nutanix using REST you will be commonly left with a json object containing list entries and properties. However, unless we are trying to list all objects and their properties you will often need to select specific entries from the json object. In the example below I demonstrate the simplest way to iterate the son object using &lt;em&gt;key&lt;/em&gt; and &lt;em&gt;value.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>How to use Python with Nutanix REST API – Part 2</title><link>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-2/</link><pubDate>Wed, 13 Jul 2016 19:44:52 +0000</pubDate><guid>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-2/</guid><description>&lt;p&gt;This is the 2nd part of my brief tutorial on how to use Python with Nutanix REST API. In case you missed, &lt;a href="https://myvirtualcloud.net/?p=8176" target="_blank"&gt;How to use Python with Nutanix REST API – Part 1&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Picking up from I left off in the 1st part... In order to make changes or trigger actions on a Nutanix object we need to execute a &lt;em&gt;http_post&lt;/em&gt; operation while sending the &lt;em&gt;base_url&lt;/em&gt; and the correct data in json format. The snippet below demonstrates a function to execute a &lt;em&gt;http_post&lt;/em&gt;. Note that I am passing username and password to the Nutanix cluster inside the function, but I recommend using a pre-defined global variable or opt for entering them also as parameters.&lt;/p&gt;</description></item><item><title>How to use Python with Nutanix REST API - Part 1</title><link>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-1/</link><pubDate>Tue, 12 Jul 2016 21:20:12 +0000</pubDate><guid>https://myvirtualcloud.net/how-to-use-python-with-nutanix-rest-api-part-1/</guid><description>&lt;p&gt;Nutanix has been built with a strong set of APIs for managing all cluster aspects and AHV virtual machines. REST API's can be called from a browser and also from pretty much any existing language out there. I have been using mostly Python Language to create my toys and prototypes, so I decided to share some instructions and code about how to use Python to connect to a Nutanix Cluster and manipulate objects. If you are not familiar with Python Language I recommend this &lt;a href="https://www.python.org/about/gettingstarted/" target="_blank"&gt;Python For Beginners&lt;/a&gt;; Python is very easy to learn!&lt;/p&gt;</description></item></channel></rss>