Hi all,
Trying to get my pyramid app to support partial and multi-threaded HTTP
downloads.
This is what I have managed to come up with so far but it is still not
working.
Any insights into what I am doing wrong would be great.
def download(request):
try:
bytes = request.GET['Accept-Ranges']
size = os.path.getsize('/home/kyle/test.bin')
f = open('/home/kyle/test.bin', 'rb')
f.seek(bytes)
response = Response(content_type='application/force-download',
content_disposition='attachment; filename=test.bin')
response.app_iter = f
response.accept_ranges = 'bytes'
response.content_length = size
except KeyError:
size = os.path.getsize('/home/kyle/test.bin')
response = Response(content_type='application/force-download',
content_disposition='attachment; filename=test.bin')
response.app_iter = open('/home/kyle/test.bin', 'rb')
response.accept_ranges = 'bytes'
response.content_length = size
return response
Thanks in advance
Kyle
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.