← Back to team overview

openstack team mailing list archive

Re: How to use the novaclient python API

 

Looks like those docs are pretty outdated. I have a github repository where I have been putting together some examples of doing common commands with
a) cli
b) python-*client
c) curl

It is incomplete but this should help get you started:

# helper method to create the client
https://github.com/vishvananda/openstack-examples/blob/master/helper.py

# keypair methods
https://github.com/vishvananda/openstack-examples/blob/master/keypair.py

Vish

On Feb 21, 2013, at 2:20 PM, JR <botemout@xxxxxxxxx> wrote:

> Greetings all,
> 
> http://docs.openstack.org/developer/python-novaclient/api.html says that:
> 
> from novaclient import OpenStack
> nova = OpenStack(USERNAME, PASSWORD, AUTH_URL)
> 
> Should work.  But:
> 
> (virtual-python2.7)ftc-ms01:test# pip search python-novaclient |head -3
> python-novaclient         - Client library for OpenStack Nova API.
>  INSTALLED: 9999.98.daee5438f2232c0467d93029bd636fc2114e4c09
>  LATEST:    2.11.1
> (virtual-python2.7)ftc-ms01:test# cat a.py
> from novaclient import OpenStack
> (virtual-python2.7)ftc-ms01:test# which python
> /src/virtual-python2.7/bin/python
> (virtual-python2.7)ftc-ms01:test# python a.py
> Traceback (most recent call last):
>  File "a.py", line 1, in <module>
>    from novaclient import OpenStack
> ImportError: cannot import name OpenStack
> 
> I've heard that the python api isn't well documented but, looking at the
> code there seems to be lots of functionality.  Could someone give me a
> hint on how to use it?
> 
> Thanks
> JR
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References