summaryrefslogtreecommitdiff
path: root/swiftclient/command_helpers.py
diff options
context:
space:
mode:
authorCharles Hsu <charles0126@gmail.com>2016-09-19 23:18:18 +0800
committerCharles Hsu <charles0126@gmail.com>2016-11-07 13:18:29 +0800
commit6cf2bd6626df8e4c68bd5463d9b030e315f76b42 (patch)
treef1b8393f5080d42d9530e7308245b34b30e33972 /swiftclient/command_helpers.py
parent0ec6b7b162a7b98ca3fad515de17d8f8a88dda72 (diff)
downloadpython-swiftclient-6cf2bd6626df8e4c68bd5463d9b030e315f76b42.tar.gz
Add additional headers for HEAD/GET/DELETE requests.
Change-Id: I69276ba711057c122f97deac412e492e313c34dd Closes-Bug: 1615830
Diffstat (limited to 'swiftclient/command_helpers.py')
-rw-r--r--swiftclient/command_helpers.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/swiftclient/command_helpers.py b/swiftclient/command_helpers.py
index 0822699..49ccad1 100644
--- a/swiftclient/command_helpers.py
+++ b/swiftclient/command_helpers.py
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from swiftclient.utils import prt_bytes
+from swiftclient.utils import prt_bytes, split_request_headers
POLICY_HEADER_PREFIX = 'x-account-storage-policy-'
@@ -19,8 +19,9 @@ POLICY_HEADER_PREFIX = 'x-account-storage-policy-'
def stat_account(conn, options):
items = []
+ req_headers = split_request_headers(options.get('header', []))
- headers = conn.head_account()
+ headers = conn.head_account(headers=req_headers)
if options['verbose'] > 1:
items.extend([
('StorageURL', conn.url),
@@ -91,8 +92,11 @@ def print_account_stats(items, headers, output_manager):
def stat_container(conn, options, container):
- headers = conn.head_container(container)
+ req_headers = split_request_headers(options.get('header', []))
+
+ headers = conn.head_container(container, headers=req_headers)
items = []
+
if options['verbose'] > 1:
path = '%s/%s' % (conn.url, container)
items.extend([
@@ -137,7 +141,9 @@ def print_container_stats(items, headers, output_manager):
def stat_object(conn, options, container, obj):
- headers = conn.head_object(container, obj)
+ req_headers = split_request_headers(options.get('header', []))
+
+ headers = conn.head_object(container, obj, headers=req_headers)
items = []
if options['verbose'] > 1:
path = '%s/%s/%s' % (conn.url, container, obj)