google-api-core 2.31.0__tar.gz → 2.32.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. {google_api_core-2.31.0/google_api_core.egg-info → google_api_core-2.32.0}/PKG-INFO +1 -1
  2. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/exceptions.py +14 -4
  3. google_api_core-2.32.0/google/api_core/gapic_v1/__init__.py +55 -0
  4. google_api_core-2.32.0/google/api_core/operations_v1/__init__.py +81 -0
  5. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/version.py +1 -1
  6. {google_api_core-2.31.0 → google_api_core-2.32.0/google_api_core.egg-info}/PKG-INFO +1 -1
  7. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/retry/test_retry_streaming_async.py +1 -1
  8. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/retry/test_retry_streaming.py +1 -1
  9. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_exceptions.py +17 -1
  10. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_python_version_support.py +20 -15
  11. google_api_core-2.31.0/google/api_core/gapic_v1/__init__.py +0 -29
  12. google_api_core-2.31.0/google/api_core/operations_v1/__init__.py +0 -40
  13. {google_api_core-2.31.0 → google_api_core-2.32.0}/LICENSE +0 -0
  14. {google_api_core-2.31.0 → google_api_core-2.32.0}/MANIFEST.in +0 -0
  15. {google_api_core-2.31.0 → google_api_core-2.32.0}/README.rst +0 -0
  16. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/__init__.py +0 -0
  17. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/_python_package_support.py +0 -0
  18. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/_python_version_support.py +0 -0
  19. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/_rest_streaming_base.py +0 -0
  20. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/bidi.py +0 -0
  21. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/bidi_async.py +0 -0
  22. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/bidi_base.py +0 -0
  23. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/client_info.py +0 -0
  24. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/client_logging.py +0 -0
  25. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/client_options.py +0 -0
  26. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/datetime_helpers.py +0 -0
  27. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/extended_operation.py +0 -0
  28. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/future/__init__.py +0 -0
  29. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/future/_helpers.py +0 -0
  30. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/future/async_future.py +0 -0
  31. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/future/base.py +0 -0
  32. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/future/polling.py +0 -0
  33. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/client_info.py +0 -0
  34. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/config.py +0 -0
  35. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/config_async.py +0 -0
  36. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/method.py +0 -0
  37. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/method_async.py +0 -0
  38. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/gapic_v1/routing_header.py +0 -0
  39. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/general_helpers.py +0 -0
  40. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/grpc_helpers.py +0 -0
  41. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/grpc_helpers_async.py +0 -0
  42. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/iam.py +0 -0
  43. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operation.py +0 -0
  44. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operation_async.py +0 -0
  45. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/abstract_operations_base_client.py +0 -0
  46. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/abstract_operations_client.py +0 -0
  47. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/operations_async_client.py +0 -0
  48. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/operations_client.py +0 -0
  49. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/operations_client_config.py +0 -0
  50. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/operations_rest_client_async.py +0 -0
  51. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/pagers.py +0 -0
  52. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/pagers_async.py +0 -0
  53. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/pagers_base.py +0 -0
  54. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/transports/__init__.py +0 -0
  55. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/transports/base.py +0 -0
  56. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/transports/rest.py +0 -0
  57. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/operations_v1/transports/rest_asyncio.py +0 -0
  58. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/page_iterator.py +0 -0
  59. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/page_iterator_async.py +0 -0
  60. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/path_template.py +0 -0
  61. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/protobuf_helpers.py +0 -0
  62. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/py.typed +0 -0
  63. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/rest_helpers.py +0 -0
  64. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/rest_streaming.py +0 -0
  65. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/rest_streaming_async.py +0 -0
  66. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/__init__.py +0 -0
  67. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/retry_base.py +0 -0
  68. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/retry_streaming.py +0 -0
  69. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/retry_streaming_async.py +0 -0
  70. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/retry_unary.py +0 -0
  71. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry/retry_unary_async.py +0 -0
  72. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/retry_async.py +0 -0
  73. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/timeout.py +0 -0
  74. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/universe.py +0 -0
  75. {google_api_core-2.31.0 → google_api_core-2.32.0}/google/api_core/version_header.py +0 -0
  76. {google_api_core-2.31.0 → google_api_core-2.32.0}/google_api_core.egg-info/SOURCES.txt +0 -0
  77. {google_api_core-2.31.0 → google_api_core-2.32.0}/google_api_core.egg-info/dependency_links.txt +0 -0
  78. {google_api_core-2.31.0 → google_api_core-2.32.0}/google_api_core.egg-info/requires.txt +0 -0
  79. {google_api_core-2.31.0 → google_api_core-2.32.0}/google_api_core.egg-info/top_level.txt +0 -0
  80. {google_api_core-2.31.0 → google_api_core-2.32.0}/pyproject.toml +0 -0
  81. {google_api_core-2.31.0 → google_api_core-2.32.0}/setup.cfg +0 -0
  82. {google_api_core-2.31.0 → google_api_core-2.32.0}/setup.py +0 -0
  83. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/__init__.py +0 -0
  84. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/__init__.py +0 -0
  85. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/future/__init__.py +0 -0
  86. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/future/test_async_future.py +0 -0
  87. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/gapic/test_config_async.py +0 -0
  88. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/gapic/test_method_async.py +0 -0
  89. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/operations_v1/__init__.py +0 -0
  90. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/operations_v1/test_operations_async_client.py +0 -0
  91. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/retry/__init__.py +0 -0
  92. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/retry/test_retry_unary_async.py +0 -0
  93. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/test_bidi_async.py +0 -0
  94. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/test_grpc_helpers_async.py +0 -0
  95. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/test_operation_async.py +0 -0
  96. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/test_page_iterator_async.py +0 -0
  97. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/asyncio/test_rest_streaming_async.py +0 -0
  98. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/helpers.py +0 -0
  99. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/__init__.py +0 -0
  100. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/future/__init__.py +0 -0
  101. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/future/test__helpers.py +0 -0
  102. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/future/test_polling.py +0 -0
  103. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/gapic/test_client_info.py +0 -0
  104. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/gapic/test_config.py +0 -0
  105. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/gapic/test_method.py +0 -0
  106. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/gapic/test_routing_header.py +0 -0
  107. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/operations_v1/__init__.py +0 -0
  108. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/operations_v1/test_operations_client.py +0 -0
  109. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/operations_v1/test_operations_rest_client.py +0 -0
  110. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/retry/__init__.py +0 -0
  111. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/retry/test_retry_base.py +0 -0
  112. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/retry/test_retry_imports.py +0 -0
  113. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/retry/test_retry_unary.py +0 -0
  114. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_bidi.py +0 -0
  115. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_client_info.py +0 -0
  116. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_client_logging.py +0 -0
  117. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_client_options.py +0 -0
  118. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_datetime_helpers.py +0 -0
  119. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_extended_operation.py +0 -0
  120. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_grpc_helpers.py +0 -0
  121. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_iam.py +0 -0
  122. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_operation.py +0 -0
  123. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_packaging.py +0 -0
  124. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_page_iterator.py +0 -0
  125. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_path_template.py +0 -0
  126. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_protobuf_helpers.py +0 -0
  127. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_python_package_support.py +0 -0
  128. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_rest_helpers.py +0 -0
  129. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_rest_streaming.py +0 -0
  130. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_timeout.py +0 -0
  131. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_universe.py +0 -0
  132. {google_api_core-2.31.0 → google_api_core-2.32.0}/tests/unit/test_version_header.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-api-core
3
- Version: 2.31.0
3
+ Version: 2.32.0
4
4
  Summary: Google API client core library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache 2.0
@@ -18,12 +18,11 @@ This module provides base classes for all errors raised by libraries based
18
18
  on :mod:`google.api_core`, including both HTTP and gRPC clients.
19
19
  """
20
20
 
21
- from __future__ import absolute_import
22
- from __future__ import unicode_literals
21
+ from __future__ import absolute_import, unicode_literals
23
22
 
24
23
  import http.client
25
- from typing import Optional, Dict
26
24
  import warnings
25
+ from typing import Dict, Optional
27
26
 
28
27
  from google.rpc import error_details_pb2
29
28
 
@@ -657,9 +656,20 @@ def from_grpc_error(rpc_exc):
657
656
  grpc is not None and isinstance(rpc_exc, grpc.Call)
658
657
  ) or _is_informative_grpc_error(rpc_exc):
659
658
  details, err_info = _parse_grpc_error_details(rpc_exc)
659
+ message = rpc_exc.details()
660
+ if (
661
+ grpc is not None
662
+ and rpc_exc.code() == grpc.StatusCode.UNIMPLEMENTED
663
+ and "Received http2 header with status: 404" in message
664
+ ):
665
+ message = (
666
+ f"{message}. This usually indicates that the 'api_endpoint' "
667
+ "configuration in ClientOptions is incorrect, contains a typo, "
668
+ "or is an invalid regional endpoint for this service."
669
+ )
660
670
  return from_grpc_status(
661
671
  rpc_exc.code(),
662
- rpc_exc.details(),
672
+ message,
663
673
  errors=(rpc_exc,),
664
674
  details=details,
665
675
  response=rpc_exc,
@@ -0,0 +1,55 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import importlib.util
16
+ from typing import Set
17
+
18
+ _has_grpc = importlib.util.find_spec("grpc") is not None
19
+
20
+ # PEP 0810: Explicit Lazy Imports
21
+ # Python 3.15+ natively intercepts and defers these imports.
22
+ # Developers can disable this behavior and force eager imports.
23
+ # For more information, see:
24
+ # https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
25
+ # Older Python versions safely ignore this variable.
26
+ __lazy_modules__: Set[str] = {
27
+ "google.api_core.gapic_v1.client_info",
28
+ "google.api_core.gapic_v1.routing_header",
29
+ }
30
+ __all__ = ["client_info", "routing_header"]
31
+
32
+ if _has_grpc:
33
+ __lazy_modules__.update(
34
+ {
35
+ "google.api_core.gapic_v1.config",
36
+ "google.api_core.gapic_v1.config_async",
37
+ "google.api_core.gapic_v1.method",
38
+ "google.api_core.gapic_v1.method_async",
39
+ }
40
+ )
41
+
42
+ from google.api_core.gapic_v1 import ( # noqa: E402
43
+ client_info,
44
+ routing_header,
45
+ )
46
+
47
+ if _has_grpc:
48
+ from google.api_core.gapic_v1 import ( # noqa: F401
49
+ config,
50
+ config_async,
51
+ method,
52
+ method_async,
53
+ )
54
+
55
+ __all__.extend(["config", "config_async", "method", "method_async"])
@@ -0,0 +1,81 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Package for interacting with the google.longrunning.operations meta-API."""
16
+
17
+ import importlib.util
18
+ from typing import Set
19
+
20
+ try:
21
+ _has_async_rest = (
22
+ importlib.util.find_spec("google.auth.aio.transport.sessions") is not None
23
+ )
24
+ except ModuleNotFoundError:
25
+ _has_async_rest = False
26
+
27
+ # PEP 0810: Explicit Lazy Imports
28
+ # Python 3.15+ natively intercepts and defers these imports.
29
+ # Developers can disable this behavior and force eager imports.
30
+ # For more information, see:
31
+ # https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
32
+ # Older Python versions safely ignore this variable.
33
+ # NOTE: We statically define all modules here (including async ones) to ensure
34
+ # static analysis tools (mypy, pyright, Ruff) can easily parse them. If async
35
+ # support is not present, the imports are ignored, making their presence safe.
36
+ __lazy_modules__: Set[str] = {
37
+ "google.api_core.operations_v1.abstract_operations_client",
38
+ "google.api_core.operations_v1.operations_async_client",
39
+ "google.api_core.operations_v1.operations_client",
40
+ "google.api_core.operations_v1.transports.rest",
41
+ "google.api_core.operations_v1.transports.rest_asyncio",
42
+ "google.api_core.operations_v1.operations_rest_client_async",
43
+ }
44
+
45
+ __all__ = [
46
+ "AbstractOperationsClient",
47
+ "OperationsAsyncClient",
48
+ "OperationsClient",
49
+ "OperationsRestTransport",
50
+ ]
51
+
52
+
53
+ from google.api_core.operations_v1.abstract_operations_client import ( # noqa: E402
54
+ AbstractOperationsClient,
55
+ )
56
+ from google.api_core.operations_v1.operations_async_client import ( # noqa: E402
57
+ OperationsAsyncClient,
58
+ )
59
+ from google.api_core.operations_v1.operations_client import ( # noqa: E402
60
+ OperationsClient,
61
+ )
62
+ from google.api_core.operations_v1.transports.rest import ( # noqa: E402
63
+ OperationsRestTransport,
64
+ )
65
+
66
+ if _has_async_rest:
67
+ try:
68
+ # On Python 3.15+, PEP 0810 lazy loading means these imports will succeed
69
+ # instantly (returning a lazy proxy). Any actual ImportErrors (e.g., due to
70
+ # missing aiohttp/auth dependencies) are deferred until the proxies are accessed.
71
+ from google.api_core.operations_v1.transports.rest_asyncio import ( # noqa: E402, F401
72
+ AsyncOperationsRestTransport,
73
+ )
74
+ from google.api_core.operations_v1.operations_rest_client_async import ( # noqa: E402, F401
75
+ AsyncOperationsRestClient,
76
+ )
77
+
78
+ __all__.extend(["AsyncOperationsRestClient", "AsyncOperationsRestTransport"])
79
+ except ImportError:
80
+ # Fallback for older python/environments when importlib find_spec succeeds but actual import fails
81
+ pass
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "2.31.0"
15
+ __version__ = "2.32.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-api-core
3
- Version: 2.31.0
3
+ Version: 2.32.0
4
4
  Summary: Google API client core library
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  License: Apache 2.0
@@ -293,7 +293,7 @@ class TestAsyncStreamingRetry(Test_BaseRetry):
293
293
  generator = await retry_(self._generator_mock)(error_on=3)
294
294
  with pytest.raises(TypeError) as exc_info:
295
295
  await generator.asend("cannot send to fresh generator")
296
- assert exc_info.match("can't send non-None value")
296
+ assert exc_info.match("can't send non-None value")
297
297
  await generator.aclose()
298
298
 
299
299
  # error thrown on 3
@@ -263,7 +263,7 @@ class TestStreamingRetry(Test_BaseRetry):
263
263
  with pytest.raises(TypeError) as exc_info:
264
264
  # calling first send with non-None input should raise a TypeError
265
265
  result.send("can not send to fresh generator")
266
- assert exc_info.match("can't send non-None value")
266
+ assert exc_info.match("can't send non-None value")
267
267
  # initiate iteration with None
268
268
  result = retry_(self._generator_mock)(error_on=3)
269
269
  assert result.send(None) == 0
@@ -25,10 +25,11 @@ try:
25
25
  except ImportError: # pragma: NO COVER
26
26
  grpc = rpc_status = None
27
27
 
28
- from google.api_core import exceptions
29
28
  from google.protobuf import any_pb2, json_format
30
29
  from google.rpc import error_details_pb2, status_pb2
31
30
 
31
+ from google.api_core import exceptions
32
+
32
33
 
33
34
  def test_create_google_cloud_error():
34
35
  exception = exceptions.GoogleAPICallError("Testing")
@@ -393,3 +394,18 @@ def test_error_details_from_grpc_response_unknown_error():
393
394
  and exception.domain is None
394
395
  and exception.metadata is None
395
396
  )
397
+
398
+
399
+ @pytest.mark.skipif(grpc is None, reason="No grpc")
400
+ def test_from_grpc_error_misleading_404():
401
+ message = "Received http2 header with status: 404"
402
+ error = mock.create_autospec(grpc.Call, instance=True)
403
+ error.code.return_value = grpc.StatusCode.UNIMPLEMENTED
404
+ error.details.return_value = message
405
+
406
+ exception = exceptions.from_grpc_error(error)
407
+
408
+ assert isinstance(exception, exceptions.MethodNotImplemented)
409
+ assert exception.grpc_status_code == grpc.StatusCode.UNIMPLEMENTED
410
+ assert "Received http2 header with status: 404" in exception.message
411
+ assert "api_endpoint" in exception.message
@@ -12,20 +12,20 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
15
  import datetime
17
16
  import textwrap
18
17
  import warnings
19
18
  from collections import namedtuple
20
-
21
19
  from unittest.mock import patch
22
20
 
21
+ import pytest
22
+
23
23
  # Code to be tested
24
24
  from google.api_core._python_version_support import (
25
+ PYTHON_VERSION_INFO,
26
+ PythonVersionStatus,
25
27
  _flatten_message,
26
28
  check_python_version,
27
- PythonVersionStatus,
28
- PYTHON_VERSION_INFO,
29
29
  )
30
30
 
31
31
  # Helper object for mocking sys.version_info
@@ -65,10 +65,12 @@ def _create_failure_message(
65
65
  )
66
66
 
67
67
 
68
- def generate_tracked_version_test_cases():
68
+ def get_tracked_version_test_cases():
69
69
  """
70
- Yields test parameters for all tracked versions and boundary conditions.
70
+ Returns a list of test parameters for all tracked versions and boundary conditions.
71
71
  """
72
+ results = []
73
+
72
74
  for version_tuple, version_info in PYTHON_VERSION_INFO.items():
73
75
  py_version_str = f"{version_tuple[0]}.{version_tuple[1]}"
74
76
  gapic_dep = version_info.gapic_deprecation or (
@@ -111,20 +113,23 @@ def generate_tracked_version_test_cases():
111
113
  }
112
114
 
113
115
  for name, params in test_cases.items():
114
- yield pytest.param(
115
- version_tuple,
116
- params["date"],
117
- params["expected"],
118
- gapic_dep,
119
- gapic_end,
120
- eol_warning_starts,
121
- id=f"{py_version_str}-{name}",
116
+ results.append(
117
+ pytest.param(
118
+ version_tuple,
119
+ params["date"],
120
+ params["expected"],
121
+ gapic_dep,
122
+ gapic_end,
123
+ eol_warning_starts,
124
+ id=f"{py_version_str}-{name}",
125
+ )
122
126
  )
127
+ return results
123
128
 
124
129
 
125
130
  @pytest.mark.parametrize(
126
131
  "version_tuple, mock_date, expected_status, gapic_dep, gapic_end, eol_warning_starts",
127
- generate_tracked_version_test_cases(),
132
+ get_tracked_version_test_cases(),
128
133
  )
129
134
  def test_all_tracked_versions_and_date_scenarios(
130
135
  version_tuple, mock_date, expected_status, gapic_dep, gapic_end, eol_warning_starts
@@ -1,29 +0,0 @@
1
- # Copyright 2017 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from google.api_core.gapic_v1 import client_info
16
- from google.api_core.gapic_v1 import config
17
- from google.api_core.gapic_v1 import config_async
18
- from google.api_core.gapic_v1 import method
19
- from google.api_core.gapic_v1 import method_async
20
- from google.api_core.gapic_v1 import routing_header
21
-
22
- __all__ = [
23
- "client_info",
24
- "config",
25
- "config_async",
26
- "method",
27
- "method_async",
28
- "routing_header",
29
- ]
@@ -1,40 +0,0 @@
1
- # Copyright 2017 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Package for interacting with the google.longrunning.operations meta-API."""
16
-
17
- from google.api_core.operations_v1.abstract_operations_client import AbstractOperationsClient
18
- from google.api_core.operations_v1.operations_async_client import OperationsAsyncClient
19
- from google.api_core.operations_v1.operations_client import OperationsClient
20
- from google.api_core.operations_v1.transports.rest import OperationsRestTransport
21
-
22
- __all__ = [
23
- "AbstractOperationsClient",
24
- "OperationsAsyncClient",
25
- "OperationsClient",
26
- "OperationsRestTransport"
27
- ]
28
-
29
- try:
30
- from google.api_core.operations_v1.transports.rest_asyncio import (
31
- AsyncOperationsRestTransport,
32
- )
33
- from google.api_core.operations_v1.operations_rest_client_async import AsyncOperationsRestClient
34
-
35
- __all__ += ["AsyncOperationsRestClient", "AsyncOperationsRestTransport"]
36
- except ImportError:
37
- # This import requires the `async_rest` extra.
38
- # Don't raise an exception if `AsyncOperationsRestTransport` cannot be imported
39
- # as other transports are still available.
40
- pass