blob.download_as_string() return 是什么编码?
What encoding does blob.download_as_string() return?
我正在从 Google 存储中下载一个字节字符串文件,对其进行 b64 编码,并将其用作 Google Vision API.
的输入
storage_client = storage.Client(project=[PROJECT])
bucket = storage_client.get_bucket([BUCKET])
blob = bucket.blob([KEY])
content = blob.download_as_string()
b64content = base64.b64encode(content)
client = vision.ImageAnnotatorClient()
image = vision.types.Image(content=b64content)
我在使用 b64 内容时遇到错误图像。但是,如果我使用非 base64 内容,我对 Vision API 的调用会成功:
image = vision.types.Image(content=content)
blob.download_as_string() return 是一个已经经过 base64 编码的字节串吗?
我正在从 Google 存储中下载一个字节字符串文件,对其进行 b64 编码,并将其用作 Google Vision API.
的输入storage_client = storage.Client(project=[PROJECT])
bucket = storage_client.get_bucket([BUCKET])
blob = bucket.blob([KEY])
content = blob.download_as_string()
b64content = base64.b64encode(content)
client = vision.ImageAnnotatorClient()
image = vision.types.Image(content=b64content)
我在使用 b64 内容时遇到错误图像。但是,如果我使用非 base64 内容,我对 Vision API 的调用会成功:
image = vision.types.Image(content=content)
blob.download_as_string() return 是一个已经经过 base64 编码的字节串吗?