Revert "Prevents the UnknownApiNameOrVersion error while upgrading google-api-python-client."
This reverts commit 58b42b1b025ed7c1b82dd14ce8a70fd914ac0082.
Reason for revert: It has to release a binary contains the patch https://android-review.googlesource.com/c/platform/tools/acloud/+/1933186 this time to solve the bug. Revert the CL and pending after the upgrading google-api-python-client review process.
Change-Id: I4c348894803fdef41f82fad97c0e6d4ca5f65449
diff --git a/internal/lib/base_cloud_client.py b/internal/lib/base_cloud_client.py
index 52b54d7..6e4400c 100755
--- a/internal/lib/base_cloud_client.py
+++ b/internal/lib/base_cloud_client.py
@@ -83,38 +83,19 @@
An apiclient.discovery.Resource object
"""
http_auth = oauth2_credentials.authorize(httplib2.Http())
- try:
- return utils.RetryExceptionType(
- exception_types=cls.RETRIABLE_AUTH_ERRORS,
- max_retries=cls.RETRY_COUNT,
- functor=build,
- sleep_multiplier=cls.RETRY_SLEEP_MULTIPLIER,
- retry_backoff_factor=cls.RETRY_BACKOFF_FACTOR,
- serviceName=cls.API_NAME,
- version=cls.API_VERSION,
- # This is workaround for a known issue of some veriosn
- # of api client.
- # https://github.com/google/google-api-python-client/issues/435
- cache_discovery=False,
- # This is workaround for the errors.UnknownApiNameOrVersion
- # https://github.com/googleapis/google-api-python-client/issues/1263
- static_discovery=False,
- http=http_auth)
- except TypeError:
- # TODO(154879379): The change should be merged before the googleapi
- # upgraded to compatible with old googleapi version which does not
- # support the argument 'static discovery'. The retry should be
- # deleted afterward.
- return utils.RetryExceptionType(
- exception_types=cls.RETRIABLE_AUTH_ERRORS,
- max_retries=cls.RETRY_COUNT,
- functor=build,
- sleep_multiplier=cls.RETRY_SLEEP_MULTIPLIER,
- retry_backoff_factor=cls.RETRY_BACKOFF_FACTOR,
- serviceName=cls.API_NAME,
- version=cls.API_VERSION,
- cache_discovery=False,
- http=http_auth)
+ return utils.RetryExceptionType(
+ exception_types=cls.RETRIABLE_AUTH_ERRORS,
+ max_retries=cls.RETRY_COUNT,
+ functor=build,
+ sleep_multiplier=cls.RETRY_SLEEP_MULTIPLIER,
+ retry_backoff_factor=cls.RETRY_BACKOFF_FACTOR,
+ serviceName=cls.API_NAME,
+ version=cls.API_VERSION,
+ # This is workaround for a known issue of some veriosn
+ # of api client.
+ # https://github.com/google/google-api-python-client/issues/435
+ cache_discovery=False,
+ http=http_auth)
@staticmethod
def _ShouldRetry(exception, retry_http_codes,
diff --git a/internal/lib/base_cloud_client_test.py b/internal/lib/base_cloud_client_test.py
index 7fabfd5..fc75358 100644
--- a/internal/lib/base_cloud_client_test.py
+++ b/internal/lib/base_cloud_client_test.py
@@ -44,7 +44,6 @@
serviceName=base_cloud_client.BaseCloudApiClient.API_NAME,
version=base_cloud_client.BaseCloudApiClient.API_VERSION,
cache_discovery=False,
- static_discovery=False,
http=mock.ANY)
def _SetupInitMocks(self):