Skip to content

Instantly share code, notes, and snippets.

@jobquiroz
Last active April 28, 2022 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobquiroz/21b25c63af750e2020dff26176fc5ca8 to your computer and use it in GitHub Desktop.
Save jobquiroz/21b25c63af750e2020dff26176fc5ca8 to your computer and use it in GitHub Desktop.
from google.cloud import storage
# Setup variables
PROJECT_ID = 'project-id' # Ver nota relacionada GCP Setup - Getting Project ID
BUCKET = "bucket-name"
REGION = 'us-central1'
storage_client = storage.Client(project = PROJECT_ID)
if not storage_client.lookup_bucket(BUCKET):
bucketDef = storage_client.bucket(BUCKET)
bucket = storage_client.create_bucket(bucketDef, project=PROJECT_ID, location=REGION)
print(bucket)
else:
print(gcs.lookup_bucket(BUCKET))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment