Skip to content

Conversation

@dhermes
Copy link
Contributor

@dhermes dhermes commented May 6, 2015

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

>>> from gcloud import _helpers
>>> from gcloud import storage
>>> 
>>> _helpers._PROJECT_ENV_VAR_NAME = 'GCLOUD_TESTS_PROJECT_ID'
>>> storage.set_defaults()
>>>
>>> with storage.Batch() as batch:
...     bucket = storage.get_bucket('bucket-name')
...     print bucket._properties
... 
<gcloud.storage.batch._FutureDict object at 0x7f7ce19f4a10>
>>> bucket._properties
{u'kind': u'storage#bucket', u'name': u'bucket-name', ...

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

>>> with storage.Batch() as batch:
...     buckets_iter = storage.list_buckets()
...     response = buckets_iter.get_next_page_response()
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "gcloud/storage/iterator.py", line 115, in get_next_page_response
    self.next_page_token = response.get('nextPageToken')
  File "gcloud/storage/batch.py", line 96, in get
    key, default))
KeyError: "Cannot get('nextPageToken', default=None) on a future"

and a blob iterator fails (but not quite always)

>>> bucket.connection
<gcloud.storage.batch.Batch object at 0x7f3b1c56db50>
>>> bucket.connection._connection
<gcloud.storage.connection.Connection object at 0x7f3b1c56d490>
>>> bucket._connection = None
>>>
>>> with storage.Batch() as batch:
...     blobs_iter = bucket.list_blobs()
...     response = blobs_iter.get_next_page_response()
...
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "gcloud/storage/iterator.py", line 111, in get_next_page_response
    response = self.connection.api_request(
AttributeError: 'NoneType' object has no attribute 'api_request'

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

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
Contributor

tseaver commented May 7, 2015

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:master May 7, 2015
@dhermes dhermes deleted the fix-blob-exists branch May 7, 2015 17:33
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 <[email protected]>
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants