File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -88,21 +88,19 @@ Windows
88
88
Example Usage
89
89
~~~~~~~~~~~~~
90
90
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
-
97
91
.. code :: python
98
92
99
93
from google.cloud import storage
100
94
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
101
100
# https://console.cloud.google.com/storage/browser/[bucket-id]/
102
- bucket = client.get_bucket(' bucket-id-here ' )
101
+ bucket = client.get_bucket(' bucket-id' )
103
102
# Then do other things...
104
103
blob = bucket.get_blob(' remote/path/to/file.txt' )
105
104
print (blob.download_as_bytes())
106
105
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
24
24
retry_timeout
25
25
generation_metageneration
26
26
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
+
27
35
Changelog
28
36
---------
29
37
.. toctree ::
You can’t perform that action at this time.
0 commit comments