Skip to content

Commit 49f78b0

Browse files
authored
docs: add links to samples and how to guides (#641)
* docs: add section for more examples * docs: revise example usage
1 parent 0b7838a commit 49f78b0

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff 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+

docs/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
2735
Changelog
2836
---------
2937
.. toctree::

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy