Commit 74672037 authored by Yan Sushchynski (EPAM)'s avatar Yan Sushchynski (EPAM) Committed by YanSushchynski
Browse files

GCP: Change blob.download_as_string to blob.download_as_bytes due to error in...

GCP: Change blob.download_as_string to blob.download_as_bytes due to error in google-storage new version
parent 34303d2c
Pipeline #59228 passed with stages
in 1 minute and 45 seconds
......@@ -105,7 +105,7 @@ class GoogleCloudStorageClient(BlobStorageClient):
bucket = self._storage_client.bucket(bucket_name)
blob = bucket.get_blob(source_blob_name)
file_as_bytes = blob.download_as_string()
file_as_bytes = blob.download_as_bytes()
logger.debug(f"File {source_blob_name} got from bucket {bucket_name}.")
return file_as_bytes, blob.content_type
......
......@@ -77,7 +77,7 @@ class GCPCredentials(BaseCredentials):
bucket = self._storage_client .bucket(bucket_name)
blob = bucket.blob(source_blob_name)
logger.info("Got SA_file.")
sa_info = json.loads(blob.download_as_string())
sa_info = json.loads(blob.download_as_bytes())
return sa_info
@staticmethod
......
......@@ -142,7 +142,7 @@ class TestGoogleCloudStorageClient:
client_mock.bucket.assert_called_with(bucket_name)
bucket_mock.get_blob.assert_called_with(blob_name)
blob_mock.download_as_string.assert_called_with()
blob_mock.download_as_bytes.assert_called_with()
@pytest.mark.parametrize("uri, bucket_name, blob_name, content_type", [
pytest.param("gs://bucket_test/name_test", "bucket_test", "name_test", "text/html"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment