Flask Endpoints for Data Set Management and Retrieval
Project description
Flask Data Sets
Flask Endpoints for Data Set Management and Retrieval
Example Usage
from frappyflaskdataset import register_endpoints
from frappyflaskauth import check_login_state
from flask import Flask
app = Flask(__name__)
# create store instances for data sets
data_store = ...
# register the endpoints
register_endpoints(app, data_store, options={
"manage_permission": "manage",
"login_check_function": check_login_state,
})
Options
Options for the register_endpoints
function are:
api_prefix
- default/api/data-sets
- is the prefix under which the endpoints will be registered. This should match the prefix used in the front-end.manage_permission
- defaultNone
- the permission required to manage data sets (upload, update, delete), ifNone
is provided the user just needs to be logged in.get_permission
- defaultNone
- the permission required to fetch data sets via the API. This can be different from themanage_permission
.data_folder
- default_data
- the local directory where to store data files (images primarily). This is relative to your applications root directory (from where you execute the start command)login_check_function
- defaultNone
- provide a function that performs authentication and uses Flask'sabort
in case the login / permission check fails. The function has 1 parameter for the required permission. You can usecheck_login_state
from thefrappyflaskauth
package.allow_public_binary_access
- defaultFalse
- a boolean flag that, when set toTrue
will allow even unauthenticated users to download the files from allBINARY
data sets andIMAGE
data sets. This allows to directly include<img src="/api/data-sets/<id>/image">
without running into authentication issues (requires usingImageView
)
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 frappyflaskdataset-1.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 462bd645e8e37a919c609e35d6a84663662ce3e33807c8dac732778442ab0221 |
|
MD5 | fccf91fde0b361cae6ee6426fddb7bd7 |
|
BLAKE2b-256 | 3369ba8b554943c58b9d5f219d8a108af29b1b09de70d6256d084fdd67972061 |