build: fix warnings in docgen (#711)
Resolved all the outstanding warnings from sphinx.
Going forward, warnings will be treated as errors since the `-W` flag is being used with `sphinx-build`
diff --git a/.trampolinerc b/.trampolinerc
new file mode 100644
index 0000000..383b6ec
--- /dev/null
+++ b/.trampolinerc
@@ -0,0 +1,52 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Template for .trampolinerc
+
+# Add required env vars here.
+required_envvars+=(
+ "STAGING_BUCKET"
+ "V2_STAGING_BUCKET"
+)
+
+# Add env vars which are passed down into the container here.
+pass_down_envvars+=(
+ "STAGING_BUCKET"
+ "V2_STAGING_BUCKET"
+ "NOX_SESSION"
+)
+
+# Prevent unintentional override on the default image.
+if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \
+ [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
+ echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
+ exit 1
+fi
+
+# Define the default value if it makes sense.
+if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
+ TRAMPOLINE_IMAGE_UPLOAD=""
+fi
+
+if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
+ TRAMPOLINE_IMAGE=""
+fi
+
+if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then
+ TRAMPOLINE_DOCKERFILE=""
+fi
+
+if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
+ TRAMPOLINE_BUILD_FILE=""
+fi
diff --git a/docs/Makefile b/docs/Makefile
deleted file mode 100644
index 4887d62..0000000
--- a/docs/Makefile
+++ /dev/null
@@ -1,225 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-BUILDDIR = _build
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-
-.PHONY: help
-help:
- @echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " applehelp to make an Apple Help Book"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " epub3 to make an epub3"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " texinfo to make Texinfo files"
- @echo " info to make Texinfo files and run them through makeinfo"
- @echo " gettext to make PO message catalogs"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " xml to make Docutils-native XML files"
- @echo " pseudoxml to make pseudoxml-XML files for display purposes"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
- @echo " coverage to run coverage check of the documentation (if enabled)"
- @echo " dummy to check syntax errors of document sources"
-
-.PHONY: clean
-clean:
- rm -rf $(BUILDDIR)/*
-
-.PHONY: html
-html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-.PHONY: dirhtml
-dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-.PHONY: singlehtml
-singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-.PHONY: pickle
-pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-.PHONY: json
-json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-.PHONY: htmlhelp
-htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-.PHONY: qthelp
-qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/google-auth.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/google-auth.qhc"
-
-.PHONY: applehelp
-applehelp:
- $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
- @echo
- @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
- @echo "N.B. You won't be able to view it unless you put it in" \
- "~/Library/Documentation/Help or install it in your application" \
- "bundle."
-
-.PHONY: devhelp
-devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/google-auth"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/google-auth"
- @echo "# devhelp"
-
-.PHONY: epub
-epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-.PHONY: epub3
-epub3:
- $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
- @echo
- @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
-
-.PHONY: latex
-latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
-
-.PHONY: latexpdf
-latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-.PHONY: latexpdfja
-latexpdfja:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through platex and dvipdfmx..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-.PHONY: text
-text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-.PHONY: man
-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-.PHONY: texinfo
-texinfo:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo
- @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
- @echo "Run \`make' in that directory to run these through makeinfo" \
- "(use \`make info' here to do that automatically)."
-
-.PHONY: info
-info:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo "Running Texinfo files through makeinfo..."
- make -C $(BUILDDIR)/texinfo info
- @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
-
-.PHONY: gettext
-gettext:
- $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
- @echo
- @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
-
-.PHONY: changes
-changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
-
-.PHONY: linkcheck
-linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
-
-.PHONY: doctest
-doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
-
-.PHONY: coverage
-coverage:
- $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
- @echo "Testing of coverage in the sources finished, look at the " \
- "results in $(BUILDDIR)/coverage/python.txt."
-
-.PHONY: xml
-xml:
- $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
- @echo
- @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
-
-.PHONY: pseudoxml
-pseudoxml:
- $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
- @echo
- @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
-
-.PHONY: dummy
-dummy:
- $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
- @echo
- @echo "Build finished. Dummy builder generates no files."
diff --git a/docs/conf.py b/docs/conf.py
index db1872e..b68467f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -369,7 +369,7 @@
"python": ("https://docs.python.org/3.5", None),
"urllib3": ("https://urllib3.readthedocs.io/en/stable", None),
"requests": ("https://requests.kennethreitz.org/en/master/", None),
- "requests-oauthlib": ("http://requests-oauthlib.readthedocs.io/en/stable", None),
+ "requests-oauthlib": ("https://requests-oauthlib.readthedocs.io/en/stable/", None),
}
# Autodoc config
diff --git a/docs/reference/google.auth.credentials_async.rst b/docs/reference/google.auth._credentials_async.rst
similarity index 100%
rename from docs/reference/google.auth.credentials_async.rst
rename to docs/reference/google.auth._credentials_async.rst
diff --git a/docs/reference/google.auth.jwt_async.rst b/docs/reference/google.auth._jwt_async.rst
similarity index 75%
rename from docs/reference/google.auth.jwt_async.rst
rename to docs/reference/google.auth._jwt_async.rst
index 4e56a6e..d27984b 100644
--- a/docs/reference/google.auth.jwt_async.rst
+++ b/docs/reference/google.auth._jwt_async.rst
@@ -1,7 +1,7 @@
google.auth.jwt\_async module
=============================
-.. automodule:: google.auth.jwt_async
+.. automodule:: google.auth._jwt_async
:members:
:inherited-members:
:show-inheritance:
diff --git a/docs/reference/google.auth.rst b/docs/reference/google.auth.rst
index e21eaf9..eb8328a 100644
--- a/docs/reference/google.auth.rst
+++ b/docs/reference/google.auth.rst
@@ -33,4 +33,4 @@
google.auth.identity_pool
google.auth.impersonated_credentials
google.auth.jwt
- google.auth.jwt_async
+ google.auth._jwt_async
diff --git a/docs/reference/google.auth.transport.aiohttp_requests.rst b/docs/reference/google.auth.transport._aiohttp_requests.rst
similarity index 100%
rename from docs/reference/google.auth.transport.aiohttp_requests.rst
rename to docs/reference/google.auth.transport._aiohttp_requests.rst
diff --git a/docs/reference/google.oauth2.credentials_async.rst b/docs/reference/google.oauth2._credentials_async.rst
similarity index 100%
rename from docs/reference/google.oauth2.credentials_async.rst
rename to docs/reference/google.oauth2._credentials_async.rst
diff --git a/docs/reference/google.oauth2.service_account_async.rst b/docs/reference/google.oauth2._service_account_async.rst
similarity index 100%
rename from docs/reference/google.oauth2.service_account_async.rst
rename to docs/reference/google.oauth2._service_account_async.rst
diff --git a/docs/user-guide.rst b/docs/user-guide.rst
index b315cc9..6674c5a 100644
--- a/docs/user-guide.rst
+++ b/docs/user-guide.rst
@@ -520,7 +520,6 @@
.. _App Engine: https://cloud.google.com/appengine/
.. _Cloud Functions: https://cloud.google.com/functions/
.. _Cloud Run: https://cloud.google.com/run/
-.. _Compute Engine: https://cloud.google.com/compute/
.. _Identity Aware Proxy: https://cloud.google.com/iap/
.. _Google OpenID Connect: https://developers.google.com/identity/protocols/OpenIDConnect
.. _Google ID Token: https://developers.google.com/identity/protocols/OpenIDConnect#validatinganidtoken
diff --git a/google/auth/crypt/_python_rsa.py b/google/auth/crypt/_python_rsa.py
index e288c50..ec30dd0 100644
--- a/google/auth/crypt/_python_rsa.py
+++ b/google/auth/crypt/_python_rsa.py
@@ -88,7 +88,7 @@
x509 public key certificate.
Returns:
- Verifier: The constructed verifier.
+ google.auth.crypt._python_rsa.RSAVerifier: The constructed verifier.
Raises:
ValueError: If the public_key can't be parsed.
diff --git a/google/auth/transport/_aiohttp_requests.py b/google/auth/transport/_aiohttp_requests.py
index aaf4e2c..4293810 100644
--- a/google/auth/transport/_aiohttp_requests.py
+++ b/google/auth/transport/_aiohttp_requests.py
@@ -131,7 +131,7 @@
credentials.refresh(request)
Args:
- session (aiohttp.ClientSession): An instance :class: aiohttp.ClientSession used
+ session (aiohttp.ClientSession): An instance :class:`aiohttp.ClientSession` used
to make HTTP requests. If not specified, a session will be created.
.. automethod:: __call__
@@ -154,15 +154,17 @@
Args:
url (str): The URL to be requested.
- method (str): The HTTP method to use for the request. Defaults
- to 'GET'.
- body (bytes): The payload / body in HTTP request.
- headers (Mapping[str, str]): Request headers.
+ method (Optional[str]):
+ The HTTP method to use for the request. Defaults to 'GET'.
+ body (Optional[bytes]):
+ The payload or body in HTTP request.
+ headers (Optional[Mapping[str, str]]):
+ Request headers.
timeout (Optional[int]): The number of seconds to wait for a
response from the server. If not specified or if None, the
requests default timeout will be used.
kwargs: Additional arguments passed through to the underlying
- requests :meth:`~requests.Session.request` method.
+ requests :meth:`requests.Session.request` method.
Returns:
google.auth.transport.Response: The HTTP response.
@@ -211,8 +213,8 @@
credentials' headers to the request and refreshing credentials as needed.
Args:
- credentials (google.auth._credentials_async.Credentials): The credentials to
- add to the request.
+ credentials (google.auth._credentials_async.Credentials):
+ The credentials to add to the request.
refresh_status_codes (Sequence[int]): Which HTTP status codes indicate
that credentials should be refreshed and the request should be
retried.
@@ -264,29 +266,26 @@
"""Implementation of Authorized Session aiohttp request.
Args:
- method: The http request method used (e.g. GET, PUT, DELETE)
-
- url: The url at which the http request is sent.
-
- data, headers: These fields parallel the associated data and headers
- fields of a regular http request. Using the aiohttp client session to
- send the http request allows us to use this parallel corresponding structure
- in our Authorized Session class.
-
+ method (str):
+ The http request method used (e.g. GET, PUT, DELETE)
+ url (str):
+ The url at which the http request is sent.
+ data (Optional[dict]): Dictionary, list of tuples, bytes, or file-like
+ object to send in the body of the Request.
+ headers (Optional[dict]): Dictionary of HTTP Headers to send with the
+ Request.
timeout (Optional[Union[float, aiohttp.ClientTimeout]]):
The amount of time in seconds to wait for the server response
- with each individual request.
-
- Can also be passed as an `aiohttp.ClientTimeout` object.
-
+ with each individual request. Can also be passed as an
+ ``aiohttp.ClientTimeout`` object.
max_allowed_time (Optional[float]):
If the method runs longer than this, a ``Timeout`` exception is
- automatically raised. Unlike the ``timeout` parameter, this
+ automatically raised. Unlike the ``timeout`` parameter, this
value applies to the total method execution time, even if
multiple requests are made under the hood.
Mind that it is not guaranteed that the timeout error is raised
- at ``max_allowed_time`. It might take longer, for example, if
+ at ``max_allowed_time``. It might take longer, for example, if
an underlying request takes a lot of time, but the request
itself does not timeout, e.g. if a large file is being
transmitted. The timout error will be raised after such
diff --git a/google/auth/transport/requests.py b/google/auth/transport/requests.py
index ef973fc..d317544 100644
--- a/google/auth/transport/requests.py
+++ b/google/auth/transport/requests.py
@@ -79,7 +79,7 @@
"""A context manager raising an error if the suite execution took too long.
Args:
- timeout ([Union[None, float, Tuple[float, float]]]):
+ timeout (Union[None, Union[float, Tuple[float, float]]]):
The maximum number of seconds a suite can run without the context
manager raising a timeout exception on exit. If passed as a tuple,
the smaller of the values is taken as a timeout. If ``None``, a
@@ -164,7 +164,7 @@
url (str): The URI to be requested.
method (str): The HTTP method to use for the request. Defaults
to 'GET'.
- body (bytes): The payload / body in HTTP request.
+ body (bytes): The payload or body in HTTP request.
headers (Mapping[str, str]): Request headers.
timeout (Optional[int]): The number of seconds to wait for a
response from the server. If not specified or if None, the
@@ -248,21 +248,23 @@
response = authed_session.request(
'GET', 'https://www.googleapis.com/storage/v1/b')
+
The underlying :meth:`request` implementation handles adding the
credentials' headers to the request and refreshing credentials as needed.
This class also supports mutual TLS via :meth:`configure_mtls_channel`
method. In order to use this method, the `GOOGLE_API_USE_CLIENT_CERTIFICATE`
- environment variable must be explicitly set to `true`, otherwise it does
- nothing. Assume the environment is set to `true`, the method behaves in the
+ environment variable must be explicitly set to ``true``, otherwise it does
+ nothing. Assume the environment is set to ``true``, the method behaves in the
following manner:
+
If client_cert_callback is provided, client certificate and private
key are loaded using the callback; if client_cert_callback is None,
application default SSL credentials will be used. Exceptions are raised if
there are problems with the certificate, private key, or the loading process,
so it should be called within a try/except block.
- First we set the environment variable to `true`, then create an :class:`AuthorizedSession`
+ First we set the environment variable to ``true``, then create an :class:`AuthorizedSession`
instance and specify the endpoints::
regular_endpoint = 'https://pubsub.googleapis.com/v1/projects/{my_project_id}/topics'
@@ -291,6 +293,7 @@
else:
response = authed_session.request('GET', regular_endpoint)
+
You can alternatively use application default SSL credentials like this::
try:
@@ -432,19 +435,17 @@
Args:
timeout (Optional[Union[float, Tuple[float, float]]]):
The amount of time in seconds to wait for the server response
- with each individual request.
-
- Can also be passed as a tuple (connect_timeout, read_timeout).
- See :meth:`requests.Session.request` documentation for details.
-
+ with each individual request. Can also be passed as a tuple
+ ``(connect_timeout, read_timeout)``. See :meth:`requests.Session.request`
+ documentation for details.
max_allowed_time (Optional[float]):
If the method runs longer than this, a ``Timeout`` exception is
- automatically raised. Unlike the ``timeout` parameter, this
+ automatically raised. Unlike the ``timeout`` parameter, this
value applies to the total method execution time, even if
multiple requests are made under the hood.
Mind that it is not guaranteed that the timeout error is raised
- at ``max_allowed_time`. It might take longer, for example, if
+ at ``max_allowed_time``. It might take longer, for example, if
an underlying request takes a lot of time, but the request
itself does not timeout, e.g. if a large file is being
transmitted. The timout error will be raised after such
diff --git a/google/oauth2/_service_account_async.py b/google/oauth2/_service_account_async.py
index 0a4e724..cfd315a 100644
--- a/google/oauth2/_service_account_async.py
+++ b/google/oauth2/_service_account_async.py
@@ -112,7 +112,7 @@
'service-account.json',
scopes=['email'],
subject='[email protected]'))
-`
+
The credentials are considered immutable. If you want to modify the scopes
or the subject used for delegation, use :meth:`with_scopes` or
:meth:`with_subject`::
diff --git a/google/oauth2/id_token.py b/google/oauth2/id_token.py
index d70782b..5e36260 100644
--- a/google/oauth2/id_token.py
+++ b/google/oauth2/id_token.py
@@ -50,7 +50,7 @@
cached_session = cachecontrol.CacheControl(session)
request = google.auth.transport.requests.Request(session=cached_session)
-.. _OpenID Connect ID Token:
+.. _OpenID Connect ID Tokens:
http://openid.net/specs/openid-connect-core-1_0.html#IDToken
.. _CacheControl: https://cachecontrol.readthedocs.io
"""
diff --git a/google/oauth2/service_account.py b/google/oauth2/service_account.py
index ed91011..1ccfa19 100644
--- a/google/oauth2/service_account.py
+++ b/google/oauth2/service_account.py
@@ -424,6 +424,7 @@
service_account.IDTokenCredentials.from_service_account_file(
'service-account.json'))
+
Or if you already have the service account file loaded::
service_account_info = json.load(open('service_account.json'))
@@ -431,6 +432,7 @@
service_account.IDTokenCredentials.from_service_account_info(
service_account_info))
+
Both helper methods pass on arguments to the constructor, so you can
specify additional scopes and a subject if necessary::
@@ -439,7 +441,8 @@
'service-account.json',
scopes=['email'],
subject='[email protected]'))
-`
+
+
The credentials are considered immutable. If you want to modify the scopes
or the subject used for delegation, use :meth:`with_scopes` or
:meth:`with_subject`::
diff --git a/google/oauth2/utils.py b/google/oauth2/utils.py
index efda796..593f032 100644
--- a/google/oauth2/utils.py
+++ b/google/oauth2/utils.py
@@ -101,7 +101,7 @@
Args:
headers (Mapping[str, str]): The HTTP request header.
- request_body (Optional[Mapping[str, str]): The HTTP request body
+ request_body (Optional[Mapping[str, str]]): The HTTP request body
dictionary. For requests that do not support request body, this
is None and will be ignored.
bearer_token (Optional[str]): The optional bearer token.
diff --git a/noxfile.py b/noxfile.py
index 6ce6346..d1f61b9 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import shutil
+import os
import nox
TEST_DEPENDENCIES = [
@@ -134,9 +136,26 @@
@nox.session(python="3.7")
def docs(session):
- session.install("sphinx", "-r", "docs/requirements-docs.txt")
- session.install(".")
- session.run("make", "-C", "docs", "html")
+ """Build the docs for this library."""
+
+ session.install("-e", ".[aiohttp]")
+ session.install(
+ "sphinx<3.0.0", "alabaster", "recommonmark", "sphinx-docstring-typing"
+ )
+
+ shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
+ session.run(
+ "sphinx-build",
+ "-T", # show full traceback on exception
+ "-W", # warnings as errors
+ "-N", # no colors
+ "-b",
+ "html",
+ "-d",
+ os.path.join("docs", "_build", "doctrees", ""),
+ os.path.join("docs", ""),
+ os.path.join("docs", "_build", "html", ""),
+ )
@nox.session(python="pypy")