8000 Can not "get_contents_as_*" when key is in a folder · Issue #354 · googleapis/google-cloud-python · GitHub
[go: up one dir, main page]

Skip to content
Can not "get_contents_as_*" when key is in a folder #354
@Fkawala

Description

@Fkawala

Warning : I might miss something fundamental in the "google storage" nomenclature !

The problem is as follows: when ones creates a key in a folder it is impossible to retrieve its data.
To code below reproduces the issue on version 0.02.2.

import time
from gcloud import storage
from gcloud.storage.demo import get_connection

c  = storage.demo.get_connection()
b = c.get_bucket('debug-gcloud-%d' % int(time.time()))
k = b.new_key("bare/my-new-file.txt")
k = set_contents_from_string("this is some dataaaaa!")
k = b.get_key("bare/my-new-file.txt")
print k.get_contents_as_string()

The error stack is presented below.
This error does not appear when the attribute name of the object key is url quoted with quote_plus from urlib.

Traceback (most recent call last):
  File "test_gcloud.py", line 12, in <module>
    k = b.get_key("bare/my-new-file.txt")
  File "/home/user/.virtualenvs/env/local/lib/python2.7/site-packages/gcloud/storage/bucket.py", line 83, in get_key
    response = self.connection.api_request(method='GET', path=key.path)
  File "/home/user/.virtualenvs/env/local/lib/python2.7/site-packages/gcloud/storage/connection.py", line 214, in api_request
    raise exceptions.NotFoundError(response, content)
  File "/home/user/.virtualenvs/env/local/lib/python2.7/site-packages/gcloud/storage/exceptions.py", line 17, in __init__
    self.message = 'GET %s returned a 404.' % (response.url)
  File "/home/user/.virtualenvs/env/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1680, in __getattr__
    raise AttributeError, name
AttributeError: url

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0