Hi!<div class="gmail_quote"><p>I have an implementation of blueprint <a href="https://blueprints.launchpad.net/nova/+spec/basic-client-library">https://blueprints.launchpad.net/nova/+spec/basic-client-library</a>.  The library is accessible at <a href="https://github.com/aababilov/python-">https://github.com/aababilov/python-</a><span class="il">openstackclient</span>-<span class="il">base</span>.</p>
<p>This library is actively used in Grid Dynamics for two month and is quite stable.</p><p>This library can be very useful for python-<span class="il">openstackclient</span> (that started to build its own client wrapper) and nova server.</p>
<p>Unfortunately, nova, keystone, and glance clients are very inconsistent. A lot
of code is copied between all these clients instead of moving it to a common library.
The code was edited without synchronization between clients, so, they have different
behaviour:</p>
<ul><li>all client constructors use different parameters (api_key in nova or
password in keystone and so on);</li><li>keystoneclient authenticates immediately in __init__, while novaclient does in lazily
during first method call;</li><li>{keystone,nova}client can manage service catalogs and accept keystone's auth URI while
glanceclient allows endpoints only;</li><li>keystoneclient can support authorization with an unscoped token but novaclient
doesn't;</li><li>novaclient uses class composition while keystoneclient uses inheritance.</li></ul>I have developed a library to unify current clients. The library can be used as-is, but it would be better if openstack clients dropped their common code (base.py, exceptions.py and so on) and just began to import common code.<br>
<br>The library performs file chunking that is necessary for the glance client. Also, it performs reauthentication if the token is expired.<br><br>Here is an example of using unified clients.<br><pre>from openstackclient_base.base import monkey_patch # optional<br>
monkey_patch()                                     # optional<br><br>from openstackclient_base.client import HttpClient
http_client = HttpClient(username="...", password="...", tenant_name="...", auth_uri="...")

from openstackclient_base.nova.client import ComputeClient
print ComputeClient(http_client).servers.list()

from openstackclient_base.keystone.client import IdentityPublicClient
print IdentityPublicClient(http_client).tenants.list()</pre>
</div><br>-- <br>Alessio Ababilov<br>Software Engineer<br>
                        
                                
                                
                                        Grid Dynamics<br><br>