Writing data to google cloud storage using python

0 votes
I am unable to use Python to upload data collection from my local computer to Google Cloud Storage. I conducted a lot of research but came up empty-handed on this. Please assist, thanks
Nov 7 in GCP by Tejashwini
• 2,860 points
65 views

1 answer to this question.

0 votes

Using the Python library for Google Cloud as an example

from google.cloud import storage

def upload_blob(bucket_name, source_file_name, destination_blob_name):
  """Uploads a file to the bucket."""
  storage_client = storage.Client()
  bucket = storage_client.get_bucket(bucket_name)
  blob = bucket.blob(destination_blob_name)

  blob.upload_from_filename(source_file_name)

  print('File {} uploaded to {}.'.format(
      source_file_name,
      destination_blob_name))
answered Nov 8 by Ashwini
• 2,760 points

Related Questions In GCP

0 votes
1 answer
0 votes
1 answer

Access public data from cloud storage without any authentication using google account.

Accessing public data with gsutil or a Cloud Storage ...READ MORE

answered Nov 12, 2019 in GCP by Sirajul
• 59,190 points
1,209 views
+2 votes
2 answers

How to download multiple files in Google Cloud Storage?

You can achieve this through the gsutil ...READ MORE

answered May 9, 2018 in GCP by kurt_cobain
• 9,390 points
20,259 views
0 votes
1 answer
0 votes
1 answer

Crawling after login in Python

You missed a few login data forms, ...READ MORE

answered Sep 7, 2018 in Python by Priyaj
• 58,100 points
1,128 views
0 votes
1 answer

Crawling after login in Python

You missed a few login data forms, ...READ MORE

answered Sep 14, 2018 in Python by Priyaj
• 58,100 points
392 views
0 votes
1 answer

“stub” __objclass__ in a Python class how to implement it?

You want to avoid interfering with this ...READ MORE

answered Sep 27, 2018 in Python by Priyaj
• 58,100 points
928 views
+1 vote
1 answer

How is raw_input() and input() in python3.x?

raw_input() was renamed to input() so now input() returns the exact string ...READ MORE

answered Oct 30, 2018 in Python by Priyaj
• 58,100 points
442 views
0 votes
1 answer

GCP - how to add a Google account as an IAM principal to a project?

I post this community wiki answer to ...READ MORE

answered Nov 10 in GCP by Ashwini
• 2,760 points
25 views
0 votes
1 answer

GCP App Engine Access to GCloud Storage without 'sharing publicly'

I believe that https://cloud.google.com/storage/docs/access-control/create-signed-urls-program will work for ...READ MORE

answered Nov 10 in GCP by Ashwini
• 2,760 points
35 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP