1515#
1616
1717from typing import Callable , Dict , Optional , Sequence , Tuple , Union
18+ import warnings
1819
20+ from google .auth import credentials as ga_credentials # type: ignore
21+ from google .auth .transport .requests import AuthorizedSession # type: ignore
22+ from google .longrunning import operations_pb2 # type: ignore
23+ import google .protobuf
24+ from google .protobuf import empty_pb2 # type: ignore
25+ from google .protobuf import json_format # type: ignore
26+ import grpc
1927from requests import __version__ as requests_version
2028
2129from google .api_core import exceptions as core_exceptions # type: ignore
2230from google .api_core import gapic_v1 # type: ignore
31+ from google .api_core import general_helpers
2332from google .api_core import path_template # type: ignore
2433from google .api_core import rest_helpers # type: ignore
2534from google .api_core import retry as retries # type: ignore
26- from google .auth import credentials as ga_credentials # type: ignore
27- from google .auth .transport .requests import AuthorizedSession # type: ignore
28- from google .longrunning import operations_pb2 # type: ignore
29- from google .protobuf import empty_pb2 # type: ignore
30- from google .protobuf import json_format # type: ignore
31- import google .protobuf
3235
33- import grpc
34- from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO , OperationsTransport
36+ from . base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
37+ from .base import OperationsTransport
3538
3639PROTOBUF_VERSION = google .protobuf .__version__
3740
@@ -91,19 +94,20 @@ def __init__(
9194 are specified, the client will attempt to ascertain the
9295 credentials from the environment.
9396
94- credentials_file (Optional[str]): A file with credentials that can
97+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
9598 be loaded with :func:`google.auth.load_credentials_from_file`.
96- This argument is ignored if ``channel`` is provided.
99+ This argument is ignored if ``channel`` is provided. This argument will be
100+ removed in the next major version of `google-api-core`.
97101
98102 .. warning::
99103 Important: If you accept a credential configuration (credential JSON/File/Stream)
100104 from an external source for authentication to Google Cloud Platform, you must
101105 validate it before providing it to any Google API or client library. Providing an
102106 unvalidated credential configuration to Google APIs or libraries can compromise
103107 the security of your systems and data. For more information, refer to
104- `Validate credential configurations from external sources`_.
108+ `Validate credential configuration from external sources`_.
105109
106- .. _Validate credential configurations from external sources:
110+ .. _Validate credential configuration from external sources:
107111
108112 https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
109113 scopes (Optional(Sequence[str])): A list of scopes. This argument is
@@ -130,6 +134,9 @@ def __init__(
130134 "v1" by default.
131135
132136 """
137+ if credentials_file is not None :
138+ warnings .warn (general_helpers ._CREDENTIALS_FILE_WARNING , DeprecationWarning )
139+
133140 # Run the base constructor
134141 # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
135142 # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
0 commit comments