From 3bf173d95885897702bc130d594d42f0e7409300 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 4 Dec 2021 15:44:41 +0100 Subject: [PATCH] Added response for kobo-benefits route and kobo-gettest route --- cps/kobo.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cps/kobo.py b/cps/kobo.py index e8ea65a4..482eb13a 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -986,6 +986,25 @@ def HandleUserRequest(dummy=None): return redirect_or_proxy_request() +@csrf.exempt +@kobo.route("/v1/user/loyalty/benefits", methods=["GET"]) +def handle_benefits(): + if config.config_kobo_proxy: + return redirect_or_proxy_request() + else: + return make_response(jsonify({"Benefits": {}})) + + +@csrf.exempt +@kobo.route("/v1/analytics/gettests", methods=["GET", "POST"]) +def handle_getests(): + if config.config_kobo_proxy: + return redirect_or_proxy_request() + else: + testkey = request.headers.get("X-Kobo-userkey","") + return make_response(jsonify({"Result": "Success", "TestKey":testkey, "Tests": {}})) + + @csrf.exempt @kobo.route("/v1/products//prices", methods=["GET", "POST"]) @kobo.route("/v1/products//recommendations", methods=["GET", "POST"]) @@ -1001,6 +1020,7 @@ def HandleUserRequest(dummy=None): @kobo.route("/v1/products/deals", methods=["GET", "POST"]) @kobo.route("/v1/products", methods=["GET", "POST"]) @kobo.route("/v1/affiliate", methods=["GET", "POST"]) +@kobo.route("/v1/deals", methods=["GET", "POST"]) def HandleProductsRequest(dummy=None): log.debug("Unimplemented Products Request received: %s", request.base_url) return redirect_or_proxy_request()