From 614a657a7bde8278827f37d116455271c1c19ca4 Mon Sep 17 00:00:00 2001 From: Felix Delattre <fd@gfz-potsdam.de> Date: Thu, 22 Jul 2021 10:21:39 +0000 Subject: [PATCH] Relied on upstream ajsonrpc quart integration --- obmdataapi/__init__.py | 2 +- obmdataapi/jsonrpcquart.py | 35 ----------------------------------- setup.py | 3 +-- 3 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 obmdataapi/jsonrpcquart.py diff --git a/obmdataapi/__init__.py b/obmdataapi/__init__.py index 9a1de2e..1aae402 100644 --- a/obmdataapi/__init__.py +++ b/obmdataapi/__init__.py @@ -20,7 +20,7 @@ import logging import sys from quart import Quart -from .jsonrpcquart import JSONRPCQuart +from ajsonrpc.backend.quart import JSONRPCQuart logger = logging.getLogger() logger.setLevel(logging.DEBUG) diff --git a/obmdataapi/jsonrpcquart.py b/obmdataapi/jsonrpcquart.py deleted file mode 100644 index dc7e6b4..0000000 --- a/obmdataapi/jsonrpcquart.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (C) 2021: -# Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero -# General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -import json - -from quart import Response, request -from ajsonrpc.backend.common import CommonBackend - - -class JSONRPCQuart(CommonBackend): - @property - def handler(self): - """Get Quart Handler""" - - async def handle(): - request_body = await request.body - response = await self.manager.get_response_for_payload(request_body) - return Response(json.dumps(response.body), mimetype="application/json") - - return handle diff --git a/setup.py b/setup.py index 705a150..0a08415 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,6 @@ from setuptools import setup, find_packages tests_require = [ "jsonrpcclient[requests]", "pytest", - "quart", ] linters_require = ["pre-commit", "pylint"] @@ -36,7 +35,7 @@ setup( license="AGPLv3+", keywords="API", author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ", - install_requires=["ajsonrpc", "quart"], + install_requires=["ajsonrpc>=1.2.0", "quart"], tests_require=tests_require, extras_require={ "tests": tests_require, -- GitLab