Skip to content

Commit 155343a

Browse files
tswastJon Wayne Parrott
authored andcommitted
Documentation: DefaultCredentialsError could be raised if credentials not supplied (googleapis#4688)
Document DefaultCredentialsError could be raised if credentials not supplied. Also, use Napoleon-style docs for the changed docs.
1 parent 8ca6882 commit 155343a

File tree

2 files changed

+40
-33
lines changed

2 files changed

+40
-33
lines changed

bigquery/google/cloud/bigquery/client.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,28 @@ def from_api_repr(cls, resource):
9393
class Client(ClientWithProject):
9494
"""Client to bundle configuration needed for API requests.
9595
96-
:type project: str
97-
:param project: the project which the client acts on behalf of. Will be
98-
passed when creating a dataset / job. If not passed,
99-
falls back to the default inferred from the environment.
100-
101-
:type credentials: :class:`~google.auth.credentials.Credentials`
102-
:param credentials: (Optional) The OAuth2 Credentials to use for this
103-
client. If not passed (and if no ``_http`` object is
104-
passed), falls back to the default inferred from the
105-
environment.
106-
107-
:type _http: :class:`~requests.Session`
108-
:param _http: (Optional) HTTP object to make requests. Can be any object
109-
that defines ``request()`` with the same interface as
110-
:meth:`requests.Session.request`. If not passed, an
111-
``_http`` object is created that is bound to the
112-
``credentials`` for the current object.
113-
This parameter should be considered private, and could
114-
change in the future.
96+
Args:
97+
project (str):
98+
Project ID for the project which the client acts on behalf of.
99+
Will be passed when creating a dataset / job. If not passed,
100+
falls back to the default inferred from the environment.
101+
credentials (google.auth.credentials.Credentials):
102+
(Optional) The OAuth2 Credentials to use for this client. If not
103+
passed (and if no ``_http`` object is passed), falls back to the
104+
default inferred from the environment.
105+
_http (requests.Session):
106+
(Optional) HTTP object to make requests. Can be any object that
107+
defines ``request()`` with the same interface as
108+
:meth:`requests.Session.request`. If not passed, an ``_http``
109+
object is created that is bound to the ``credentials`` for the
110+
current object.
111+
This parameter should be considered private, and could change in
112+
the future.
113+
114+
Raises:
115+
google.auth.exceptions.DefaultCredentialsError:
116+
Raised if ``credentials`` is not specified and the library fails
117+
to acquire default credentials.
115118
"""
116119

117120
SCOPE = ('https://www.googleapis.com/auth/bigquery',

core/google/cloud/client.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,24 @@ class Client(_ClientFactoryMixin):
9494
Callers and subclasses may seek to use the private key from
9595
``credentials`` to sign data.
9696
97-
:type credentials: :class:`~google.auth.credentials.Credentials`
98-
:param credentials: (Optional) The OAuth2 Credentials to use for this
99-
client. If not passed (and if no ``_http`` object is
100-
passed), falls back to the default inferred from the
101-
environment.
102-
103-
:type _http: :class:`~requests.Session`
104-
:param _http: (Optional) HTTP object to make requests. Can be any object
105-
that defines ``request()`` with the same interface as
106-
:meth:`requests.Session.request`. If not passed, an
107-
``_http`` object is created that is bound to the
108-
``credentials`` for the current object.
109-
This parameter should be considered private, and could
110-
change in the future.
97+
Args:
98+
credentials (google.auth.credentials.Credentials):
99+
(Optional) The OAuth2 Credentials to use for this client. If not
100+
passed (and if no ``_http`` object is passed), falls back to the
101+
default inferred from the environment.
102+
_http (requests.Session):
103+
(Optional) HTTP object to make requests. Can be any object that
104+
defines ``request()`` with the same interface as
105+
:meth:`requests.Session.request`. If not passed, an ``_http``
106+
object is created that is bound to the ``credentials`` for the
107+
current object.
108+
This parameter should be considered private, and could change in
109+
the future.
110+
111+
Raises:
112+
google.auth.exceptions.DefaultCredentialsError:
113+
Raised if ``credentials`` is not specified and the library fails
114+
to acquire default credentials.
111115
"""
112116

113117
SCOPE = None

0 commit comments

Comments
 (0)