You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Observe that requests are sent to Host: localhost:9023 except the batch requests go to Host: storage.googleapis.com
Code example
fromhttpimportclientashttp_clientfromgoogle.auth.credentialsimportAnonymousCredentialsfromgoogle.cloudimportstorage, exceptionshttp_client.HTTPConnection.debuglevel=5client=storage.Client(
credentials=AnonymousCredentials(),
project="test",
)
bucket=client.get_bucket("test-bucket")
blob=bucket.blob("key1")
blob.upload_from_string("test1")
blob=bucket.blob("key2")
blob.upload_from_string("test2")
withclient.batch():
bucket.delete_blob("key1")
bucket.delete_blob("key2")
# List the Blobs in each Bucketforblobinbucket.list_blobs():
print(f"Blob: {blob.name}")
Stderr
Traceback (most recent call last):
File "test.py", line 19, in <module>
bucket.delete_blob("key2")
File "/home/user/venv/lib/python3.7/site-packages/google/cloud/storage/batch.py", line 292, in __exit__
self.finish()
File "/home/user/venv/lib/python3.7/site-packages/google/cloud/storage/batch.py", line 278, in finish
self._finish_futures(responses)
File "/home/user/venv/lib/python3.7/site-packages/google/cloud/storage/batch.py", line 259, in _finish_futures
raise exceptions.from_http_response(exception_args)
google.api_core.exceptions.NotFound: 404 BATCH contentid://None: No such object: test-bucket/key2
Environment details
google-cloud-storageversion: 1.35.1Steps to reproduce
export STORAGE_EMULATOR_HOST=http://localhost:9023Host: localhost:9023except the batch requests go toHost: storage.googleapis.comCode example
Stderr
Stdout