Registry / devops / flask-accepts

flask-accepts

JSON →
library1.0.1pypypiunverified

Easy, opinionated Flask input/output handling with Flask-restx and Marshmallow. Provides decorators to validate request data against Marshmallow schemas and serialize responses. Current version 1.0.1. Maintenance mode, low release cadence.

pip install flask-accepts
INSTALL
IMPORT
SIG · FLASK-ACCEPTS
F
flask-accepts
devopspythonv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Accepts
from flask_accepts import Accepts
from flask_accepts import Accepts
responds
from flask_accepts import responds
accepts
from flask_accepts import accepts

Initialize Accepts with Flask app, then decorate routes with @accepts to validate JSON input against a Marshmallow schema.

from flask import Flask from marshmallow import Schema, fields from flask_accepts import Accepts, responds app = Flask(__name__) app.config['SECRET_KEY'] = 'secret' accepts = Accepts(app) class MySchema(Schema): name = fields.String(required=True) @app.route('/hello', methods=['POST']) @accepts('json', schema=MySchema) def hello(): return {'message': 'Hello ' + app.json.get('json').name} if __name__ == '__main__': app.run()
Debug
Known issues
breakingflask-accepts 1.0.0+ renamed the primary class from 'Accept' to 'Accepts' and removed deprecated imports. Old code using `from flask_accepts import accepts` (lowercase) will break.
fix
Use `from flask_accepts import Accepts` (capitalized) and instantiate `Accepts(app)`.
affects: <1.0.0
gotchaThe @accepts decorator must be applied BEFORE @responds in the decorator stack. Order matters for correct validation.
fix
Stack decorators as: @accepts('json', schema=...) first, then @responds(schema=...) if used.
affects: all
deprecatedflask-accepts is in maintenance mode with no active development. It may not work with newer Flask or marshmallow versions.
fix
Consider migrating to Flask-RESTx, webargs, or marshmallow directly for active support.
affects: >=1.0.0
gotchaThe library only supports JSON input by default ('json' argument). For other content types, you must specify them explicitly.
fix
Use `@accepts('json', schema=...)` for JSON; other types like 'form' are not directly supported.
affects: all
Upgrade
Version history
1.0.1latest on PyPI · released Sep 17, 2024
Audit
Dependencies
FlaskrequiredWeb framework required
marshmallowrequiredSchema validation and serialization
Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

flask-accepts — pip install flask-accepts · libregistry