pycontribs / pyrax

The Python SDK for the Rackspace Cloud
developer.rackspace.com
Apache License 2.0
237 stars 208 forks source link

object.get_metadata doesn't get metadata #537

Closed briancurtin closed 9 years ago

briancurtin commented 9 years ago

With debug logging enabled, you can see that the proper request and response are happening, but the response isn't hooked up to the object.

>>> ob.get_metadata()

REQ: curl -i -X HEAD -H 'X-Auth-Project-Id: 123456' -H 'User-Agent: pyrax/1.9.3' -H 'Accept: application/json' -H 'X-Auth-Token: xxx https://storage101.ord1.clouddrive.com/v1/xxxx/testing/blah

RESP: <Response [200]>
{'content-length': '12', 'accept-ranges': 'bytes', 'last-modified': 'Wed, 04 Dec 2013 22:17:25 GMT', 'etag': '9893532233caff98cd083a116b013c0b', 'x-timestamp': '1386195444.63863', 'x-trans-id': 'tx7bbf4ff6d76f4ab993ba6-0054da297dord1', 'date': 'Tue, 10 Feb 2015 15:53:33 GMT', 'content-type': 'application/octet-stream'}
{}

That empty dict at the end is the return value and the dict above it is the metadata showing up from the logging.

briancurtin commented 9 years ago

FWIW, ob.fetch(include_meta=True) does properly return metadata

toddgjohnson commented 9 years ago

Curious to see a code snippet.

This gist works for me.

REQ: curl -i -X HEAD -H 'X-Auth-Project-Id: 123456' -H 'User-Agent: pyrax/1.9.3' -H 'Accept: application/json' -H 'X-Auth-Token: abcd' https://storage101.ord1.clouddrive.com/v1/xxx/xyz/test.txt

RESP: <Response [200]>
{'content-length': '13', 'accept-ranges': 'bytes', 'x-object-meta-m1': '1429938184', 'last-modified': 'Fri, 06 Mar 2015 00:03:55 GMT', 'etag': '8c3c1a60b5c10f3faacd15ae3b1db6fb', 'x-timestamp': '1425600234.31237', 'x-trans-id': 'tx0c9d18fff68b4020af8df-0054f8f10eord1', 'date': 'Fri, 06 Mar 2015 00:13:02 GMT', 'content-type': 'text/plain'}
{'m1': '1429938184'}
briancurtin commented 9 years ago

Never mind. get_metadata - either on containers or objects - only returns user-specified metadata, while I was thinking it returns all metadata.