Skip to content

Making Blob.exists() work as Bucket.exists(). - #862

Merged
dhermes merged 1 commit into
googleapis:masterfrom
dhermes:fix-blob-exists
May 7, 2015
Merged

Making Blob.exists() work as Bucket.exists().#862
dhermes merged 1 commit into
googleapis:masterfrom
dhermes:fix-blob-exists

Conversation

@dhermes

Copy link
Copy Markdown
Contributor

Also returning the _BucketIterator directly in
storage.api.list_buckets() rather than wrapping it in iter().

@tseaver As mentioned #812 (comment) I said I'd fix Blob.exists() while making sure the iterators didn't work in batches.

It turns out they were already not working. Here is a working get request

>>>fromgcloudimport_helpers>>>fromgcloudimportstorage>>>>>>_helpers._PROJECT_ENV_VAR_NAME='GCLOUD_TESTS_PROJECT_ID'>>>storage.set_defaults()
>>>>>>withstorage.Batch() asbatch:
... bucket=storage.get_bucket('bucket-name')
... printbucket._properties
... <gcloud.storage.batch._FutureDictobjectat0x7f7ce19f4a10>>>>bucket._properties
{u'kind': u'storage#bucket', u'name': u'bucket-name', ...

while a bucket iterator fails since _FutureDict.get throws a KeyError:

>>>withstorage.Batch() asbatch:
... buckets_iter=storage.list_buckets()
... response=buckets_iter.get_next_page_response()
... Traceback (mostrecentcalllast):
File"<stdin>", line3, in<module>File"gcloud/storage/iterator.py", line115, inget_next_page_responseself.next_page_token=response.get('nextPageToken')
File"gcloud/storage/batch.py", line96, ingetkey, default))
KeyError: "Cannot get('nextPageToken', default=None) on a future"

and a blob iterator fails (but not quite always)

>>>bucket.connection<gcloud.storage.batch.Batchobjectat0x7f3b1c56db50>>>>bucket.connection._connection<gcloud.storage.connection.Connectionobjectat0x7f3b1c56d490>>>>bucket._connection=None>>>>>>withstorage.Batch() asbatch:
... blobs_iter=bucket.list_blobs()
... response=blobs_iter.get_next_page_response()
...
Traceback (mostrecentcalllast):
File"<stdin>", line3, in<module>File"gcloud/storage/iterator.py", line111, inget_next_page_responseresponse=self.connection.api_request(
AttributeError: 'NoneType'objecthasnoattribute'api_request'

Also returning the _BucketIterator directly in
storage.api.list_buckets() rather than wrapping it in iter().
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label May 6, 2015
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling bf8b655 on dhermes:fix-blob-exists into aafcd2a on GoogleCloudPlatform:master.

@tseaver

Copy link
Copy Markdown
Contributor

LGTM

dhermes added a commit that referenced this pull request May 7, 2015
Making Blob.exists() work as Bucket.exists().
@dhermes
dhermes merged commit a9bc7fe into googleapis:masterMay 7, 2015
@dhermes
dhermes deleted the fix-blob-exists branch May 7, 2015 17:33
@dhermesdhermes mentioned this pull request Jun 4, 2015
parthea added a commit that referenced this pull request Nov 22, 2025
* docs: Minor formatting
chore: Update gapic-generator-python to v1.11.5
build: Update rules_python to 0.24.0
PiperOrigin-RevId: 563436317
Source-Link: googleapis/googleapis@42fd37b
Source-Link: googleapis/googleapis-gen@280264c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjgwMjY0Y2EwMmZiOTMxNmI0MjM3YTk2ZDBhZjFhMjM0M2E4MWE1NiJ9
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* fix: add feature flag for improved mutate rows throttling
PiperOrigin-RevId: 565090488
Source-Link: googleapis/googleapis@e8a136f
Source-Link: googleapis/googleapis-gen@9a8dcca
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWE4ZGNjYTBmYjIxMTc2MjhhMWE2YTZjMzYyNWE2YWEzMmZjMmY3NSJ9
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
The objects.inv files for two different library deps
are currently inaccessible due to redirects.
In the meantime, allow continuing to build the docs by caching
them locally.
They are second in the list, so if the original URL's
start serving the files themselves, there will be no need
to update conf.py again. The cache is strictly a fallback.
Fixes#862
parthea added a commit that referenced this pull request Mar 9, 2026
* chore(deps): update all dependencies
* revert
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@dhermes@coveralls@tseaver@googlebot