Skip to content

Instantly share code, notes, and snippets.

@tseaver
Created June 27, 2018 20:01
Show Gist options
  • Save tseaver/224e54aa87ee85c22400265b7b5a0a14 to your computer and use it in GitHub Desktop.
Save tseaver/224e54aa87ee85c22400265b7b5a0a14 to your computer and use it in GitHub Desktop.
import os
import sys
from google.cloud import storage
BUCKET_NAME = 'gcp-5254-repro'
FILE_NAME = 'dataset/VIDEO-2018-06-06-12-26-54.mp4'
def main():
client = storage.Client()
print('Fetching GCS /buckets/{}'.format(BUCKET_NAME))
bucket = client.get_bucket(BUCKET_NAME)
blob = bucket.blob(FILE_NAME)
assert(blob.exists())
outfile = os.path.join(sys.prefix, os.path.basename(FILE_NAME))
print('Downloading GCS /buckets/{}/{} to {}'.format(
BUCKET_NAME, FILE_NAME, outfile))
blob.download_to_filename(outfile)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment