From ff6c4bb9a4cc0717bd3107b9f5d3a7cbaad87caa Mon Sep 17 00:00:00 2001 From: Souheil Chelfouh Date: Fri, 17 Nov 2023 17:38:04 +0100 Subject: [PATCH 1/5] Added extra request headers capabilities to stat_object --- docs/API.md | 1 + minio/api.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 5fdb5176b..b97395eb0 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1385,6 +1385,7 @@ __Parameters__ | `object_name` | _str_ | Object name in the bucket. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | | `version_id` | _str_ | Version ID of the object. | +| `request_headers` | _dict_ | Any additional headers to be added with GET request. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | __Return Value__ diff --git a/minio/api.py b/minio/api.py index 2dcffa854..75af1443c 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1853,7 +1853,7 @@ def list_objects(self, bucket_name, prefix=None, recursive=False, ) def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, - extra_query_params=None): + request_headers=None, extra_query_params=None): """ Get object information and metadata of an object. @@ -1861,6 +1861,7 @@ def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, :param object_name: Object name in the bucket. :param ssec: Server-side encryption customer key. :param version_id: Version ID of the object. + :param request_headers: Any additional headers to be added with GET request. :param extra_query_params: Extra query parameters for advanced usage. :return: :class:`Object `. @@ -1886,6 +1887,9 @@ def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, check_ssec(ssec) headers = ssec.headers() if ssec else {} + if request_headers: + headers.update(request_headers) + query_params = extra_query_params or {} query_params.update({"versionId": version_id} if version_id else {}) response = self._execute( From b893b1e738464e6fc1cc25d4d92460d6ace00ce9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 21 Nov 2023 22:08:39 -0800 Subject: [PATCH 2/5] Apply suggestions from code review --- docs/API.md | 2 +- minio/api.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/API.md b/docs/API.md index b97395eb0..a0eebe1e1 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1385,7 +1385,7 @@ __Parameters__ | `object_name` | _str_ | Object name in the bucket. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | | `version_id` | _str_ | Version ID of the object. | -| `request_headers` | _dict_ | Any additional headers to be added with GET request. | +| `extra_headers` | _dict_ | Any additional headers to be added with GET request. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | __Return Value__ diff --git a/minio/api.py b/minio/api.py index e6491507f..5e6677c61 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1853,7 +1853,7 @@ def list_objects(self, bucket_name, prefix=None, recursive=False, ) def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, - request_headers=None, extra_query_params=None): + extra_headers=None, extra_query_params=None): """ Get object information and metadata of an object. @@ -1887,8 +1887,8 @@ def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, check_ssec(ssec) headers = ssec.headers() if ssec else {} - if request_headers: - headers.update(request_headers) + if extra_headers: + headers.update(extra_headers) query_params = extra_query_params or {} query_params.update({"versionId": version_id} if version_id else {}) From 3d5e34fc2b5aed40218e6170fe7ee631641c5622 Mon Sep 17 00:00:00 2001 From: Souheil Chelfouh Date: Wed, 22 Nov 2023 11:12:29 +0100 Subject: [PATCH 3/5] Fixed stat_object docstring --- minio/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minio/api.py b/minio/api.py index 57a81e540..3214ca196 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1862,7 +1862,7 @@ def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, :param object_name: Object name in the bucket. :param ssec: Server-side encryption customer key. :param version_id: Version ID of the object. - :param request_headers: Any additional headers to be added with GET request. + :param extra_headers: Additional headers to be added with GET request. :param extra_query_params: Extra query parameters for advanced usage. :return: :class:`Object `. From 03c380e4965d3fa6d80a7c4bc30b872dc29b544e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 26 Nov 2023 20:18:02 -0800 Subject: [PATCH 4/5] Apply suggestions from code review --- docs/API.md | 2 +- minio/api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/API.md b/docs/API.md index a0eebe1e1..650928fd2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1385,7 +1385,7 @@ __Parameters__ | `object_name` | _str_ | Object name in the bucket. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | | `version_id` | _str_ | Version ID of the object. | -| `extra_headers` | _dict_ | Any additional headers to be added with GET request. | +| `extra_headers` | _dict_ | Extra HTTP headers for advanced usage. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | __Return Value__ diff --git a/minio/api.py b/minio/api.py index 3214ca196..a66df2602 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1862,7 +1862,7 @@ def stat_object(self, bucket_name, object_name, ssec=None, version_id=None, :param object_name: Object name in the bucket. :param ssec: Server-side encryption customer key. :param version_id: Version ID of the object. - :param extra_headers: Additional headers to be added with GET request. + :param extra_headers: Extra HTTP headers for advanced usage. :param extra_query_params: Extra query parameters for advanced usage. :return: :class:`Object `. From d27d2cf3797f382db0bec72533252870f08dc643 Mon Sep 17 00:00:00 2001 From: Bala FA Date: Mon, 27 Nov 2023 13:06:11 +0530 Subject: [PATCH 5/5] Update docs/API.md --- docs/API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 650928fd2..f34b7f74a 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1385,7 +1385,7 @@ __Parameters__ | `object_name` | _str_ | Object name in the bucket. | | `ssec` | _SseCustomerKey_ | Server-side encryption customer key. | | `version_id` | _str_ | Version ID of the object. | -| `extra_headers` | _dict_ | Extra HTTP headers for advanced usage. | +| `extra_headers` | _dict_ | Extra HTTP headers for advanced usage. | | `extra_query_params` | _dict_ | Extra query parameters for advanced usage. | __Return Value__