Skip to content

Instantly share code, notes, and snippets.

@larkintuckerllc
Created December 14, 2020 20:23
Show Gist options
  • Save larkintuckerllc/d7d885301085c77cfd0fb33715bca67f to your computer and use it in GitHub Desktop.
Save larkintuckerllc/d7d885301085c77cfd0fb33715bca67f to your computer and use it in GitHub Desktop.
"""Interact with Google Cloud SDK"""
from os import environ
from google.cloud import storage
from google.oauth2.credentials import Credentials
def interact():
access_token = environ.get('ACCESS_TOKEN')
credentials = Credentials(access_token) if access_token is not None else None
storage_client = storage.Client(project='hello-accounts', credentials=credentials)
buckets = storage_client.list_buckets()
for bucket in buckets:
print(bucket.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment