Skip to main content

Range Requests for Flask

Project description

Flask-RangeRequest

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

Example

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

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

@app.route('/', methods=('GET', 'POST'))
def index():
    return RangeRequest(open(__file__, 'rb'),
                        etag=etag,
                        last_modified=last_modified,
                        size=size).make_response()

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8080, debug=True)

License

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

Project details


Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask_RangeRequest-0.0.0-py3-none-any.whl (4.0 kB) Copy SHA256 hash SHA256 Wheel py3
Flask-RangeRequest-0.0.0.tar.gz (3.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page