I'd like to use GCP to download a file from web and store it in the Google Cloud Storage Bucket.
For example, I need to download this file: https://gist.github.com/alwerner/5429504/archive/be5e2858bb31b37e0ba386ca2ce349bf0c3e20ef.zip
I've tried this code (https://stackoverflow.com/a/70366028):
from google.cloud import storage
def write_file():
client = storage.Client()
bucket = client.get_bucket('bucket-name')
blob = bucket.blob('path/to/new-blob.txt')
with blob.open(mode='w') as f:
for line in object:
f.write(line)
Unfortunately, I don't know how to use it in case of web file. How to download my file (by cloud function?) and store in the bucket on GCP?