{"id":339,"date":"2016-01-05T13:12:25","date_gmt":"2016-01-05T13:12:25","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=339"},"modified":"2016-01-05T13:12:25","modified_gmt":"2016-01-05T13:12:25","slug":"using-python-with-nova-client-to-list-servers","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/01\/05\/using-python-with-nova-client-to-list-servers\/","title":{"rendered":"Using Python with nova-client to list servers"},"content":{"rendered":"<p>A customer came to me today complaining about his code not working. He&#8217;d forgot to include the &#8216;account-number&#8217;, also refered to as the project_id in openstack. Without it, your going to get HTTP 405, i.e. MethodNotAllowed: Method Not Allowed (HTTP 405)<\/p>\n<pre>\r\nfrom novaclient import client\r\n\r\nnova = client.Client (\"2\" ,\"username\", \"password\", \"account-number\", \"https:\/\/lon.identity.api.rackspacecloud.com\/v2.0\")\r\n\r\nlist = nova.servers.list()\r\n\r\nprint list\r\n<\/pre>\n<p>This does what it says on the tin, queries the API using nova python module to extract server list.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer came to me today complaining about his code not working. He&#8217;d forgot to include the &#8216;account-number&#8217;, also refered to as the project_id in openstack. Without it, your going to get HTTP 405, i.e. MethodNotAllowed: Method Not Allowed (HTTP &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/01\/05\/using-python-with-nova-client-to-list-servers\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,11,12],"tags":[],"class_list":["post-339","post","type-post","status-publish","format-standard","hentry","category-api","category-openstack","category-openstack-api"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=339"}],"version-history":[{"count":1,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/339\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/339\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}