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, 2022 in GCP by Tejashwini
• 3,820 points
1,382 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))

If you need to know more about Cloud Computing, We recommend joining Cloud Computing Course today.

answered Nov 8, 2022 by Ashwini
• 5,430 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,230 points
2,063 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,350 points
23,583 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,020 points
1,701 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,020 points
874 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,020 points
2,379 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,020 points
918 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, 2022 in GCP by Ashwini
• 5,430 points
1,196 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, 2022 in GCP by Ashwini
• 5,430 points
856 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