Skip to main content

Flask Endpoints for Content Management and Retrieval

Project description

Flask Content

Flask Endpoints for Content Management and Retrieval

  1. Example Usage
  2. Options

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 - default None - the permission required to manage content (create, update, delete), if None is provided the user just needs to be logged in.
  • get_permission - default None - the permission required to fetch content via the API. This can be different from the manage_permission.
  • login_check_function - default None - provide a function that performs authentication and uses Flask's abort in case the login / permission check fails. The function has 1 parameter for the required permission. You can use check_login_state from the frappyflaskauth package.
  • allow_get_without_auth - default True - whether an anonymous user can retrieve content via the GET endpoints.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frappyflaskcontent-1.1.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

frappyflaskcontent-1.1.1-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page