15
15
#
16
16
17
17
from typing import Callable , Dict , Optional , Sequence , Tuple , Union
18
+ import warnings
18
19
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
19
27
from requests import __version__ as requests_version
20
28
21
29
from google .api_core import exceptions as core_exceptions # type: ignore
22
30
from google .api_core import gapic_v1 # type: ignore
31
+ from google .api_core import general_helpers
23
32
from google .api_core import path_template # type: ignore
24
33
from google .api_core import rest_helpers # type: ignore
25
34
from 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
32
35
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
35
38
36
39
PROTOBUF_VERSION = google .protobuf .__version__
37
40
@@ -91,19 +94,20 @@ def __init__(
91
94
are specified, the client will attempt to ascertain the
92
95
credentials from the environment.
93
96
94
- credentials_file (Optional[str]): A file with credentials that can
97
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
95
98
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`.
97
101
98
102
.. warning::
99
103
Important: If you accept a credential configuration (credential JSON/File/Stream)
100
104
from an external source for authentication to Google Cloud Platform, you must
101
105
validate it before providing it to any Google API or client library. Providing an
102
106
unvalidated credential configuration to Google APIs or libraries can compromise
103
107
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`_.
105
109
106
- .. _Validate credential configurations from external sources:
110
+ .. _Validate credential configuration from external sources:
107
111
108
112
https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
109
113
scopes (Optional(Sequence[str])): A list of scopes. This argument is
@@ -130,6 +134,9 @@ def __init__(
130
134
"v1" by default.
131
135
132
136
"""
137
+ if credentials_file is not None :
138
+ warnings .warn (general_helpers ._CREDENTIALS_FILE_WARNING , DeprecationWarning )
139
+
133
140
# Run the base constructor
134
141
# TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
135
142
# TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
0 commit comments