Google Cloud Platform Storage Bucket
This package just aims to make life a little bit easier for people who have to work with google cloud storage bucket.
Quickstart:
- get the package
pip install 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.comexport GOOGLE_APPLICATION_CREDENTIALS='key.json'
- Run some code:
from storage_bucket.download_file import DownloadFile, download_file
def use_data_for_something(data):
print(data)
# Normal way, this might throw exception... handle them yourself.
my_data = download_file(
'my_bucket',
'my_file.txt',
)
use_data_for_something(my_data)
# Returns Modal way
# this will _only_ call use_data_for_something when data is successfully downloaded.
# so its completely safe.
DownloadFile()(
'my_bucket',
'my_file.txt',
).map(
use_data_for_something, # send data to this function,
)
File/blob operations
Download
from storage_bucket.download_file import DownloadFile, download_file
DownloadFile()('bucket', 'filename')
download_file('bucket', 'filename')
Upload
from storage_bucket.upload_file import UploadFile, upload_file
UploadFile()(b'data', 'bucket_name', 'filename')
upload_file(b'data', 'bucket_name', 'filename')
List
from storage_bucket.list_files import ListFiles, list_files
ListFiles()('bucket')
list_files('bucket')
ListFiles()('bucket', 'foldername/')
list_files('bucket', 'foldername/')
Delete
from storage_bucket.delete_file import DeleteFile, delete_file
DeleteFile()('bucketname', 'filename')
delete_file('bucketname', 'filename')
Bucket operations
Create Bucket
from storage_bucket.create import CreateBucket, create_bucket
CreateBucket()('bucket-name', 'EU', 'STANDARD')
create_bucket('bucket-name', 'EU', 'STANDARD')
Delete Bucket
from storage_bucket.delete import DeleteBucket, delete_bucket
DeleteBucket()('bucket-name')
delete_bucket('bucket-name')
List Buckets
from storage_bucket.list import ListBuckets, list_buckets, list_bucket_names
buckets = ListBuckets()()
bucket_names = list_bucket_names(buckets.unwrap())
buckets2 = list_buckets()
bucket_names2 = list_bucket_names(buckets2)
The use of Returns library.
- Lets us get rid of all exceptions.
- Lets us chain stuff so everything looks good.
- Lets you use
DownloadFile()(args...).map(dostuff).alt(dostuffonfailure) - Don't like it? use the matching normal function provided for your convenience.
Contribution
Like the library and want to help us, check: CONTRIBUTING.md
Metadata
Release files for storage-bucket 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| storage-bucket-1.0.0.tar.gz | 7.6 kB | Without provenance | Details for storage-bucket-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| storage_bucket-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for storage_bucket-1.0.0-py3-none-any.whl |
Total release size: 17.8 kB
Release files / storage-bucket-1.0.0.tar.gz
| Download URL | storage-bucket-1.0.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d726e5c25511e5074739a3bc1ecf25803dc521dc62bc4836e3b1994b61c2097
|
|
BLAKE2b-256 checksum How to use checksums |
f8c2b43bf7d118fc8c1d718813eb830693df9f9229d1f49b46b36fc0e835b3a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/4.15.0-1077-aws
|
Release files / storage_bucket-1.0.0-py3-none-any.whl
| Download URL | storage_bucket-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dff8f5fb928d27b320f608c86cfc1916501b8b0d7d342d2848cea9c547120774
|
|
BLAKE2b-256 checksum How to use checksums |
685ecfe9ff07df239c3a7058c1d3b42c40914833f43384eb5bf84af7b28c866b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/4.15.0-1077-aws
|
Security for storage-bucket 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.