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
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'),
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 | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Flask_RangeRequest-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90e0c3d26a494a083b6c87e0b16f2ed21d90719d0c51441ed27cfa922c08db81 |
|
MD5 | f7932478b4b273649d919a365fc6c613 |
|
BLAKE2b-256 | 82b040c91c8d0ee0889c2b4e4b8c37c4c399ce5fe2bebb3d98a3ef259ad94683 |