Pyramid, partial and resumable downloads, HTTP Accept Ranges

8 views
Skip to first unread message

Mikko Ohtamaa

unread,
Jun 28, 2022, 4:01:34 PMJun 28
to pylons-...@googlegroups.com
Hi,

What would be an easy way to support partial downloads / resumes with Pyramid? Namely HTTP Accept Ranges come to my mind, but there could be others.

- Serving files directly from FS using FileResponse

- Using gunicorn as a web server


Br,
Mikko

Theron Luhn

unread,
Jun 28, 2022, 6:28:23 PMJun 28
to pylons-...@googlegroups.com
Easiest way is to not do it :)  I try to offload downloads/uploads to a service like S3.  Let somebody else do the heavy lifting.  If authentication is needed, I’ll generate a presigned URL in Pyramid and redirect.

AFAIA, Accept-Ranges is the only real HTTP solution for resumable/multipart downloads.

If you’re using nginx in front of gunicorn (which you should be), you can have nginx cache the response and handle Range for you.  https://www.nginx.com/blog/smart-efficient-byte-range-caching-nginx/  You could also skip Pyramid altogether and serve file directly with nginx, using the auth_request module if you need auth.  https://nginx.org/en/docs/http/ngx_http_auth_request_module.html 

If none of that is feasible, rolling your own FileResponse that handles Range shouldn’t be too difficult, although personally that’d be my very last option.

— Theron



--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAK8RCUurRhwaqBem%3DVi3OEYWw-oMZh0fhRqCqZcjPiGibyO8Rw%40mail.gmail.com.

Jonathan Vanasco

unread,
Jul 8, 2022, 1:52:18 PMJul 8
to pylons-discuss
^ ditto
Reply all
Reply to author
Forward
0 new messages