diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-10-12 00:55:30 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-10-12 00:55:30 +0200 |
commit | 7d29e6204e1ed3d5e5d71842e541a8ea3ad279a9 (patch) | |
tree | 183cbf20344d5866df11da8b71da4fcdcd525af9 | |
parent | removed .github directory (diff) | |
download | newspipe-7d29e6204e1ed3d5e5d71842e541a8ea3ad279a9.tar.gz newspipe-7d29e6204e1ed3d5e5d71842e541a8ea3ad279a9.tar.bz2 newspipe-7d29e6204e1ed3d5e5d71842e541a8ea3ad279a9.zip |
chg: [API] allow search with filters from controllers for articles.
-rw-r--r-- | newspipe/web/views/api/v2/common.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/newspipe/web/views/api/v2/common.py b/newspipe/web/views/api/v2/common.py index 332c07f8..d785dda5 100644 --- a/newspipe/web/views/api/v2/common.py +++ b/newspipe/web/views/api/v2/common.py @@ -109,6 +109,13 @@ class PyAggAbstractResource(Resource): parser.add_argument( attr_name, location="json", default=in_values[attr_name] ) + + if not default: + for value in in_values: + parser.add_argument( + value, location="json", default=in_values[value] + ) + return parser.parse_args(req=request.args, strict=strict) @@ -146,6 +153,7 @@ class PyAggResourceMulti(PyAggAbstractResource): try: limit = request.json.pop("limit", 10) order_by = request.json.pop("order_by", None) + args = self.reqparse_args(right="read", default=True) except Exception: args = self.reqparse_args(right="read", default=False) limit = request.args.get("limit", 10) |