Skip to content

thomasborgen/storage-bucket

Repository files navigation

Storage Bucket

Makes working with GCP Storage bucket a breeze


test codecov Python Version wemake-python-styleguide


Documentation | Source Code | Issue Tracker

The goal of this package is to make it easy to work with GCP Storage Bucket. We felt that using googles package(google-cloud-storage) was a horrible experience and we believe that this package abstracts away the object oriented approach taken by google and introduces a more functional approach.

Quickstart

Get the package

pip install storage-bucket

Or better with poetry

poetry add storage-bucket

Download your keyfile and save it as key.json and point to it with env var:

gcloud iam service-accounts keys create key.json --iam-account your_service_account@your_project.iam.gserviceaccount.com
export GOOGLE_APPLICATION_CREDENTIALS='key.json'

Download

from storage_bucket import download_file

file_data = download_file('bucket', 'filename')

print(file_data)

Upload

from storage_bucket import upload_file

upload_file(b'data', 'bucket_name', 'filename')

Supported operations - File

Download, Upload, List, Delete

Supported operations - Bucket

Create, Delete, List

Check Usage.

Contribution

Like the library and want to help us, check: contributing