Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions gcloud/storage/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
content_type=None):
"""Upload the contents of this key from a file-like object.

.. note::

The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.

See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.

:type file_obj: file
:param file_obj: A file handle open for reading.

Expand Down Expand Up @@ -276,6 +288,18 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
def upload_from_filename(self, filename):
"""Upload this key's contents from the content of f named file.

.. note::

The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.

See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.

:type filename: string
:param filename: The path to the file.
"""
Expand All @@ -290,6 +314,18 @@ def upload_from_filename(self, filename):
def upload_from_string(self, data, content_type='text/plain'):
"""Upload contents of this key from the provided string.

.. note::

The effect of uploading to an existing key depends on the
"versioning" and "lifecycle" policies defined on the key's
bucket. In the absence of those policies, upload will
overwrite any existing contents.

See the `object versioning
<https://cloud.google.com/storage/docs/object-versioning>`_ and
`lifecycle <https://cloud.google.com/storage/docs/lifecycle>`_
API documents for details.

:type data: string
:param data: The data to store in this key.

Expand Down