-
Notifications
You must be signed in to change notification settings - Fork 930
Add Rackspace Cloud Files TempURL support #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…urned metadata dictionary
return response.status in [httplib.OK, httplib.NO_CONTENT, | ||
httplib.CREATED, httplib.ACCEPTED] | ||
|
||
def ex_get_container_temp_url(self, container, method, timeout=60): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the docs (http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html), you also need to specify an object prefix when creating a temp URL for a container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that, yeah. That's only for PUTs though, right? And I don't see where the prefix goes, is it a query param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, documentation isn't totally cleared - would need to check the code.
Cloud Files account using \ | ||
ex_set_account_metadata_temp_url_key before \ | ||
you can use this method.") | ||
hmac_body = "%s\n%s\n%s" % (method, expires, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style bike shed: use single quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try: | ||
key = self.ex_get_meta_data()['temp_url_key'] | ||
assert key is not None | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IRC, the correct Pythonic way is doing except Exception:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…_ex_get_object_temp_url_no_key_raises_key_error
|
||
from libcloud.utils.py3 import httplib | ||
from libcloud.utils.py3 import urllib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use libcloud.utils.py3.urlencode
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
container=container, meta_data=None, | ||
driver=self) | ||
exception_string = 'You must first set the X-Account-Meta-Temp-URL-Key header on your Cloud Files account using ex_set_account_metadata_temp_url_key before you can use this method.' | ||
with self.assertRaisesRegexp(KeyError, exception_string): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not available in version < 2.7 so you can't do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Merged into trunk (http://svn.apache.org/viewvc?view=revision&revision=1370664) with some changes:
|
This has been merged, can you please close this PR? |
No description provided.