diff options
Diffstat (limited to 'openstackclient/object/v1/lib')
| -rw-r--r-- | openstackclient/object/v1/lib/container.py | 20 | ||||
| -rw-r--r-- | openstackclient/object/v1/lib/object.py | 24 |
2 files changed, 21 insertions, 23 deletions
diff --git a/openstackclient/object/v1/lib/container.py b/openstackclient/object/v1/lib/container.py index 5103d9d4..0bae2349 100644 --- a/openstackclient/object/v1/lib/container.py +++ b/openstackclient/object/v1/lib/container.py @@ -67,19 +67,18 @@ def list_containers( data.extend(listing) return data - object_url = url - query = "format=json" + params = { + 'format': 'json', + } if marker: - query += '&marker=%s' % marker + params['marker'] = marker if limit: - query += '&limit=%d' % limit + params['limit'] = limit if end_marker: - query += '&end_marker=%s' % end_marker + params['end_marker'] = end_marker if prefix: - query += '&prefix=%s' % prefix - url = "%s?%s" % (object_url, query) - response = api.request('GET', url) - return response.json() + params['prefix'] = prefix + return api.list(url, params=params) def show_container( @@ -95,9 +94,8 @@ def show_container( :returns: dict of returned headers """ - object_url = "%s/%s" % (url, container) + response = api.head("%s/%s" % (url, container)) url_parts = urlparse(url) - response = api.request('HEAD', object_url) data = { 'account': url_parts.path.split('/')[-1], 'container': container, diff --git a/openstackclient/object/v1/lib/object.py b/openstackclient/object/v1/lib/object.py index 8ad5e5a5..6f9c9d63 100644 --- a/openstackclient/object/v1/lib/object.py +++ b/openstackclient/object/v1/lib/object.py @@ -86,22 +86,23 @@ def list_objects( return data object_url = url - query = "format=json" + params = { + 'format': 'json', + } if marker: - query += '&marker=%s' % marker + params['marker'] = marker if limit: - query += '&limit=%d' % limit + params['limit'] = limit if end_marker: - query += '&end_marker=%s' % end_marker + params['end_marker'] = end_marker if delimiter: - query += '&delimiter=%s' % delimiter + params['delimiter'] = delimiter if prefix: - query += '&prefix=%s' % prefix + params['prefix'] = prefix if path: - query += '&path=%s' % path - url = "%s/%s?%s" % (object_url, container, query) - response = api.request('GET', url) - return response.json() + params['path'] = path + url = "%s/%s" % (object_url, container) + return api.list(url, params=params) def show_object( @@ -118,9 +119,8 @@ def show_object( :returns: dict of object properties """ - object_url = "%s/%s/%s" % (url, container, obj) + response = api.head("%s/%s/%s" % (url, container, obj)) url_parts = urlparse(url) - response = api.request('HEAD', object_url) data = { 'account': url_parts.path.split('/')[-1], 'container': container, |
