From 8a473a2bc2cc73216a9ac27f6c5c5208a830e9f0 Mon Sep 17 00:00:00 2001 From: Pablo Orviz Date: Mon, 19 Feb 2024 15:13:01 +0100 Subject: [PATCH] Support for a query 'q' parameter --- api/rda.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/api/rda.py b/api/rda.py index edc85dd7..74e5b591 100644 --- a/api/rda.py +++ b/api/rda.py @@ -21,13 +21,16 @@ def load_evaluator(wrapped_func): @wraps(wrapped_func) def wrapper(body, **kwargs): repo = body.get("repo") - item_id = body.get("id") + item_id = body.get("id", "") oai_base = body.get("oai_base") lang = body.get("lang", "en") - logger.debug( - "Parsing input args: (repo: %s, item_id: %s, oai_base: %s, lang: %s)" - % (repo, item_id, oai_base, lang) - ) + pattern_to_query = body.get("q", "") + + logger.debug("JSON payload received: %s" % body) + if not (item_id or pattern_to_query): + msg = "Neither the identifier nor the pattern to query was provided. Exiting.." + logger.error(msg) + return msg, 400 try: if repo == "oai-pmh": eva = Evaluator(item_id, oai_base, lang)