RSGISLib Google Cloud Tools
- rsgislib.tools.googlecloud.blob_exists(goog_cred, bucket_name, filename)
A function to test whether a file .
- Parameters:
file_to_upload – The local file to be uploaded.
goog_cred – The JSON credentials file from Google.
bucket_name – The google bucket name.
filename – The file path within the bucket for the file. Note this should not start with a slash. i.e., directory/path rather than /directory/path.
- Returns:
boolean (True if the file exists / False if the file does not exist)
- rsgislib.tools.googlecloud.list_files(goog_cred, bucket_name, bucket_dir)
A function to list the contents of a directory within a bucket.
- Parameters:
goog_cred – The JSON credentials file from Google.
bucket_name – The google bucket name.
bucket_dir – The directory path within the bucket to be listed. Note this should not start with a slash. i.e., directory/path rather than /directory/path.
- Returns:
returns a list of file paths.
- rsgislib.tools.googlecloud.upload_to_google_bucket(file_to_upload, goog_cred, bucket_name, bucket_dir)
A function to upload a file to a google cloud bucket. Once the file is uploaded the presence of the file is checked. If the file is not present then an exception is raised.
- Parameters:
file_to_upload – The local file to be uploaded.
goog_cred – The JSON credentials file from Google.
bucket_name – The google bucket name.
bucket_dir – The directory path within the bucket for the file to be saved. Note this should not start with a slash. i.e., directory/path rather than /directory/path.