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
File details
Details for the file Flask-RangeRequest-0.0.2.tar.gz
.
File metadata
- Download URL: Flask-RangeRequest-0.0.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c27507dcda610c9bf94c9ffd4408afcfae33cd86baa073988a951428a8972b40 |
|
MD5 | 4870a22b7277cc2b9f98624358f2906c |
|
BLAKE2b-256 | 0938081ebf56ab6caf988f4c239345c2356dbec70ec7c7160ed176d5e34023e0 |
File details
Details for the file Flask_RangeRequest-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: Flask_RangeRequest-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90e0c3d26a494a083b6c87e0b16f2ed21d90719d0c51441ed27cfa922c08db81 |
|
MD5 | f7932478b4b273649d919a365fc6c613 |
|
BLAKE2b-256 | 82b040c91c8d0ee0889c2b4e4b8c37c4c399ce5fe2bebb3d98a3ef259ad94683 |