Skip to content
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

Unable to do range requests (regression from python-cloudfiles) #150

Closed
joeshaw opened this issue Jul 30, 2013 · 1 comment
Closed

Unable to do range requests (regression from python-cloudfiles) #150

joeshaw opened this issue Jul 30, 2013 · 1 comment

Comments

@joeshaw
Copy link
Contributor

joeshaw commented Jul 30, 2013

As far as I can tell, there's no way to do a partial download from cloudfiles using the Range header via pyrax.

In python-cloudfiles you could do this:

obj.read(size=8192)

But there doesn't seem to be an equivalent in pyrax/swiftclient. AFAICT the best you can do is pass in a chunk_size to fetch() but then you still have to read the rest of the data and discard it:

g = obj.fetch(chunk_size=8192)
data = g.next()
for chunk in g:
    pass

Obviously this has a pretty serious impact on performance for files of any size above the chunk_size.

@EdLeafe
Copy link
Contributor

EdLeafe commented Jul 30, 2013

That sounds like a good idea for an enhancement. In the meantime, you could manually close the connection like this:

g = obj.fetch(chunk_size=8192)
data = g.next()
cf.connection.http_conn[1].close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants