- Notifications
You must be signed in to change notification settings - Fork 163
Closed
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Thanks for fixing #324. I just noticed that create_bucket still expects a project. Would it make sense that it'd also detect STORAGE_EMULATOR_HOST and use a "fake" project automatically like here?
Environment details
- OS type and version: MacOS 12.1
- Python version:
python --versionPython 3.9.9 - pip version:
pip --versionpip 21.3.1 google-cloud-storageversion:pip show google-cloud-storage2.1.0
Steps to reproduce
- See the example below.
Code example
import os from google.cloud import storage HOST = "localhost" PORT = 9023 BUCKET = "test-bucket" os.environ["STORAGE_EMULATOR_HOST"] = f"http://{HOST}:{PORT}" client = storage.Client() bucket = client.create_bucket(BUCKET)Stack trace
Traceback (most recent call last): File "/Users/user/workspace/temp/test.py", line 12, in <module> bucket = client.create_bucket(BUCKET) File "/Users/user/workspace/temp/.venv/lib/python3.9/site-packages/google/cloud/storage/client.py", line 940, in create_bucket raise ValueError("Client project not set: pass an explicit project.") ValueError: Client project not set: pass an explicit project. Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.