in src/mozmlops/cloud_storage_api_client.py [0:0]
def fetch(self, remote_path: str, local_path: str) -> str:
"""
Arguments:
remote_path (str): The filepath on GCS from which to fetch the data.
storage_path (str): The local filepath in which to store the data.
Fetches a file
at a specific remote_path within the GCS project and bucket specified
and stores it at a location specified by local_path.
"""
from google.cloud import storage
client = storage.Client(project=self.gcs_project_name)
bucket = client.get_bucket(self.gcs_bucket_name)
blob = bucket.blob(remote_path)
# Create any directory that's needed.
p = Path(local_path)
p.parent.mkdir(parents=True, exist_ok=True)
blob.download_to_filename(local_path)