Blob.download_as_text tries to use the content-encoding header to decode the bytes. In most cases that value is gzip, even though the bytes were already decompressed at that point. In other cases, e.g text/plain; charset=utf-8, the value does not make sense to Python's bytes.decode.
File "/storage/bazel-cache/_bazel_kornholi/9f066b43468ef9bfd3c6a621a4515622/execroot/__main__/bazel-out/k8-opt/bin/foo.runfiles/pypi__google_cloud_storage_1_33_0/google/cloud/storage/blob.py", line 1424, in download_as_text
return data.decode(self.content_encoding)
LookupError: unknown encoding: gzip
I don't think we can be smarter here than passing through the encoding kwarg which defaults to utf-8.
Reactions are currently unavailable
Blob.download_as_text tries to use the content-encoding header to decode the bytes. In most cases that value is gzip, even though the bytes were already decompressed at that point. In other cases, e.g text/plain; charset=utf-8, the value does not make sense to Python's bytes.decode.
File "/storage/bazel-cache/_bazel_kornholi/9f066b43468ef9bfd3c6a621a4515622/execroot/__main__/bazel-out/k8-opt/bin/foo.runfiles/pypi__google_cloud_storage_1_33_0/google/cloud/storage/blob.py", line 1424, in download_as_text return data.decode(self.content_encoding) LookupError: unknown encoding: gzipI don't think we can be smarter here than passing through the encoding kwarg which defaults to utf-8.