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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7717b0e66c5ca9209ca544964e0b6c2bda3e52d5b873217e457d1f9a82357d2 |
|
MD5 | ca364d91c8b5ffaf0731f7b399fc3af0 |
|
BLAKE2b-256 | f6953642d11d44353d9751e810fe9dd52613f179faf5e8e8758a526cdbe228b3 |