Skip to main content

Range Requests for Flask

Project description


PyPI Version CI Documentation Status

Flask-RangeRequest adds range request (RFC 7233) support to your Flask app.


from datetime import datetime
from flask import Flask
from flask_rangerequest import RangeRequest
from os import path

my_file = '/path/to/file'
app = Flask(__name__)
size = path.getsize(my_file)
with open(my_file, 'rb') as f:
    etag = RangeRequest.make_etag(f)
last_modified = datetime.utcnow()

@app.route('/', methods=('GET', 'POST'))
def index():
    return RangeRequest(open(my_file, 'rb'),

if __name__ == '__main__':'', port=8080, debug=True)


This work is dual licensed under the MIT and Apache-2.0 licenses. See LICENSE-MIT and LICENSE-APACHE for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-RangeRequest-0.0.2.tar.gz (8.5 kB view hashes)

Uploaded source

Built Distribution

Flask_RangeRequest-0.0.2-py3-none-any.whl (9.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page