Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
Removing redundant Bucket.upload* methods.#1002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dhermes
merged 1 commit into
googleapis:master
from
dhermes:remove-redundant-storage-methodJul 21, 2015
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -16,7 +16,6 @@ | ||
| import datetime | ||
| import copy | ||
| import os | ||
| import pytz | ||
| import six | ||
| @@ -442,98 +441,6 @@ def copy_blob(self, blob, destination_bucket, new_name=None, | ||
| new_blob._set_properties(copy_result) | ||
| return new_blob | ||
| def upload_file(self, filename, blob_name=None, client=None): | ||
| """Shortcut method to upload a file into this bucket. | ||
| Use this method to quickly put a local file in Cloud Storage. | ||
| For example:: | ||
| >>> from gcloud import storage | ||
| >>> client = storage.Client() | ||
| >>> bucket = client.get_bucket('my-bucket') | ||
| >>> bucket.upload_file('~/my-file.txt', 'remote-text-file.txt') | ||
| >>> print bucket.list_blobs() | ||
| [<Blob: my-bucket, remote-text-file.txt>] | ||
| If you don't provide a blob name, we will try to upload the file | ||
| using the local filename (**not** the complete path):: | ||
| >>> from gcloud import storage | ||
| >>> client = storage.Client() | ||
| >>> bucket = client.get_bucket('my-bucket') | ||
| >>> bucket.upload_file('~/my-file.txt') | ||
| >>> print bucket.list_blobs() | ||
| [<Blob: my-bucket, my-file.txt>] | ||
| :type filename: string | ||
| :param filename: Local path to the file you want to upload. | ||
| :type blob_name: string | ||
| :param blob_name: The name of the blob to upload the file to. If this | ||
| is blank, we will try to upload the file to the root | ||
| of the bucket with the same name as on your local | ||
| file system. | ||
| :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` | ||
| :param client: Optional. The client to use. If not passed, falls back | ||
| to the ``client`` stored on the current bucket. | ||
| :rtype: :class:`Blob` | ||
| :returns: The updated Blob object. | ||
| """ | ||
| if blob_name is None: | ||
| blob_name = os.path.basename(filename) | ||
| blob = Blob(bucket=self, name=blob_name) | ||
| blob.upload_from_filename(filename, client=client) | ||
| return blob | ||
| def upload_file_object(self, file_obj, blob_name=None, client=None): | ||
| """Shortcut method to upload a file object into this bucket. | ||
| Use this method to quickly put a local file in Cloud Storage. | ||
| For example:: | ||
| >>> from gcloud import storage | ||
| >>> client = storage.Client() | ||
| >>> bucket = client.get_bucket('my-bucket') | ||
| >>> bucket.upload_file(open('~/my-file.txt'), 'remote-text-file.txt') | ||
| >>> print bucket.list_blobs() | ||
| [<Blob: my-bucket, remote-text-file.txt>] | ||
| If you don't provide a blob name, we will try to upload the file | ||
| using the local filename (**not** the complete path):: | ||
| >>> from gcloud import storage | ||
| >>> client = storage.Client() | ||
| >>> bucket = client.get_bucket('my-bucket') | ||
| >>> bucket.upload_file(open('~/my-file.txt')) | ||
| >>> print bucket.list_blobs() | ||
| [<Blob: my-bucket, my-file.txt>] | ||
| :type file_obj: file | ||
| :param file_obj: A file handle open for reading. | ||
| :type blob_name: string | ||
| :param blob_name: The name of the blob to upload the file to. If this | ||
| is blank, we will try to upload the file to the root | ||
| of the bucket with the same name as on your local | ||
| file system. | ||
| :type client: :class:`gcloud.storage.client.Client` or ``NoneType`` | ||
| :param client: Optional. The client to use. If not passed, falls back | ||
| to the ``client`` stored on the current bucket. | ||
| :rtype: :class:`Blob` | ||
| :returns: The updated Blob object. | ||
| """ | ||
| if blob_name is None: | ||
| blob_name = os.path.basename(file_obj.name) | ||
| blob = Blob(bucket=self, name=blob_name) | ||
| blob.upload_from_file(file_obj, client=client) | ||
| return blob | ||
| @property | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| def cors(self): | ||
| """Retrieve CORS policies configured for this bucket. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.