From a8b9c69c9ab8651047ca35aed4a7c94a4018dd22 Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Mon, 28 Oct 2019 15:51:01 -0700 Subject: [PATCH 1/4] fix: add gcloud-python header to user agent --- storage/google/cloud/storage/_http.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/google/cloud/storage/_http.py b/storage/google/cloud/storage/_http.py index 7bd5d7673a26..56c32b381f58 100644 --- a/storage/google/cloud/storage/_http.py +++ b/storage/google/cloud/storage/_http.py @@ -35,6 +35,11 @@ def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT): super(Connection, self).__init__(client, client_info) self.API_BASE_URL = api_endpoint self._client_info.client_library_version = __version__ + + # TODO: When metrics all use gccl, this should be removed b/143493862 + if self._client_info.user_agent is None: + self._client_info.user_agent = "" + self._client_info.user_agent += " gcloud-python/{client_library_version} " API_VERSION = "v1" """The version of the API, used in building the API call's URL.""" From bc28c2a56279ae9df292517a40acf53fd0f87399 Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Mon, 28 Oct 2019 16:00:31 -0700 Subject: [PATCH 2/4] fix: change to public bug --- storage/google/cloud/storage/_http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/google/cloud/storage/_http.py b/storage/google/cloud/storage/_http.py index 56c32b381f58..48bd7e3caf23 100644 --- a/storage/google/cloud/storage/_http.py +++ b/storage/google/cloud/storage/_http.py @@ -36,10 +36,10 @@ def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT): self.API_BASE_URL = api_endpoint self._client_info.client_library_version = __version__ - # TODO: When metrics all use gccl, this should be removed b/143493862 + # TODO: When metrics all use gccl, this should be removed #9552 if self._client_info.user_agent is None: self._client_info.user_agent = "" - self._client_info.user_agent += " gcloud-python/{client_library_version} " + self._client_info.user_agent += " gcloud-python/{} ".format(__version__) API_VERSION = "v1" """The version of the API, used in building the API call's URL.""" From 2eb906533b8e994f13824a06ff14e003f7543098 Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Mon, 28 Oct 2019 16:23:30 -0700 Subject: [PATCH 3/4] fix: lint --- storage/google/cloud/storage/_http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/google/cloud/storage/_http.py b/storage/google/cloud/storage/_http.py index 48bd7e3caf23..603a9cd08a3b 100644 --- a/storage/google/cloud/storage/_http.py +++ b/storage/google/cloud/storage/_http.py @@ -35,7 +35,7 @@ def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT): super(Connection, self).__init__(client, client_info) self.API_BASE_URL = api_endpoint self._client_info.client_library_version = __version__ - + # TODO: When metrics all use gccl, this should be removed #9552 if self._client_info.user_agent is None: self._client_info.user_agent = "" From d3b3a6e3e21b76a3fa22f106784d49d85ec5c44c Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Mon, 28 Oct 2019 16:46:13 -0700 Subject: [PATCH 4/4] fix: no cover --- storage/google/cloud/storage/_http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/google/cloud/storage/_http.py b/storage/google/cloud/storage/_http.py index 603a9cd08a3b..032f70e02185 100644 --- a/storage/google/cloud/storage/_http.py +++ b/storage/google/cloud/storage/_http.py @@ -37,7 +37,7 @@ def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT): self._client_info.client_library_version = __version__ # TODO: When metrics all use gccl, this should be removed #9552 - if self._client_info.user_agent is None: + if self._client_info.user_agent is None: # pragma: no branch self._client_info.user_agent = "" self._client_info.user_agent += " gcloud-python/{} ".format(__version__)