This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,21 +88,19 @@ Windows
8888 Example Usage
8989~~~~~~~~~~~~~
9090
91- You need to create a Google Cloud Storage bucket to use this client library.
92- Follow along with the `official Google Cloud Storage documentation `_ to learn
93- how to create a bucket.
94-
95- .. _official Google Cloud Storage documentation : https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
96-
9791.. code :: python
9892
9993 from google.cloud import storage
10094 client = storage.Client()
95+ new_bucket = client.create_bucket(' new-bucket-id' )
96+ new_blob = new_bucket.blob(' remote/path/storage.txt' )
97+ new_blob.upload_from_filename(filename = ' /local/path.txt' )
98+
99+ # Retrieve an existing bucket
101100 # https://console.cloud.google.com/storage/browser/[bucket-id]/
102- bucket = client.get_bucket(' bucket-id-here ' )
101+ bucket = client.get_bucket(' bucket-id' )
103102 # Then do other things...
104103 blob = bucket.get_blob(' remote/path/to/file.txt' )
105104 print (blob.download_as_bytes())
106105 blob.upload_from_string(' New contents!' )
107- blob2 = bucket.blob(' remote/path/storage.txt' )
108- blob2.upload_from_filename(filename = ' /local/path.txt' )
106+
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ API Reference
2424 retry_timeout
2525 generation_metageneration
2626
27+ More Examples
28+ -------------
29+ .. toctree ::
30+ :maxdepth: 2
31+
32+ Official Google Cloud Storage How-to Guides <https://cloud.google.com/storage/docs/how-to >
33+ Official Google Cloud Storage Samples <https://cloud.google.com/storage/docs/samples >
34+
2735Changelog
2836---------
2937.. toctree ::
You can’t perform that action at this time.
0 commit comments