aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbojeil-google <bojeil-google@users.noreply.github.com>2021-08-09 21:23:25 -0700
committerGitHub <noreply@github.com>2021-08-09 21:23:25 -0700
commitda8bb13c1349e771ffc2e125256030495c53d956 (patch)
tree2ce2bfe4831a9cd8388bc3a960b4dffe78df9706
parentd1840dcdcd03dfd7fdfa81d08da68402f6f8b658 (diff)
downloadgoogle-auth-library-python-da8bb13c1349e771ffc2e125256030495c53d956.tar.gz
fix: downscoping documentation bugs (#830)
Fixes the following issues: - Change `google.oauth2.Credentials` to `google.oauth2.credentials.Credentials` - Replace deprecated `blob.download_as_string()` with `blob.download_as_bytes()`
-rw-r--r--docs/user-guide.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/user-guide.rst b/docs/user-guide.rst
index de284b8..ccece57 100644
--- a/docs/user-guide.rst
+++ b/docs/user-guide.rst
@@ -507,7 +507,7 @@ Token Consumer ::
# refresh handler to handle token expiration. Passing the original
# downscoped token or the expiry here is optional, as the refresh_handler
# will generate the downscoped token on demand.
- credentials = google.oauth2.Credentials(
+ credentials = google.oauth2.credentials.Credentials(
downscoped_token,
expiry=expiry,
scopes=['https://www.googleapis.com/auth/cloud-platform'],
@@ -521,7 +521,7 @@ Token Consumer ::
# in bucket "bucket-123".
bucket = storage_client.bucket('bucket-123')
blob = bucket.blob('customer-a-data.txt')
- print(blob.download_as_string())
+ print(blob.download_as_bytes().decode("utf-8"))
Another reason to use downscoped credentials is to ensure tokens in flight