Flask Endpoints for Content Management and Retrieval
Project description
Flask Content
Flask Endpoints for Content Management and Retrieval
Example Usage
from frappyflaskcontent import register_endpoints
from frappyflaskauth import check_login_state
from flask import Flask
app = Flask(__name__)
# create store instances for content
content_store = ...
# register the endpoints
register_endpoints(app, content_store, options={
"manage_permission": "manage",
"login_check_function": check_login_state,
})
Options
Options for the register_endpoints
function are:
api_prefix
- default/api/content
- 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 content (create, update, delete), ifNone
is provided the user just needs to be logged in.get_permission
- defaultNone
- the permission required to fetch content via the API. This can be different from themanage_permission
.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_get_without_auth
- defaultTrue
- whether an anonymous user can retrieve content via the GET endpoints.
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 frappyflaskcontent-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f418b81f8c63de75558df0add3472af9f5ab7591adf559f48487143563e53084 |
|
MD5 | fc7c8428c5b29cc02aa2ce1a81427cc9 |
|
BLAKE2b-256 | b01a832da9512f3e047145ff1d5867dc7cffe790a9f3c598e21afd77c19ba64c |