diff --git a/maloja/__main__.py b/maloja/__main__.py index 28b66cc..c6b48f9 100644 --- a/maloja/__main__.py +++ b/maloja/__main__.py @@ -14,7 +14,7 @@ from . import __pkginfo__ as pkginfo from .pkg_global import conf from .proccontrol import tasks from .setup import setup -from .dev import generate +from .dev import generate, apidebug @@ -159,6 +159,7 @@ def main(*args,**kwargs): "backup":tasks.backup, # maloja backup --targetfolder /x/y --include_images "generate":generate.generate_scrobbles, # maloja generate 400 "export":tasks.export, # maloja export + "apidebug":apidebug.run, # maloja apidebug # aux "info":print_info } diff --git a/maloja/dev/apidebug.py b/maloja/dev/apidebug.py new file mode 100644 index 0000000..970fcb1 --- /dev/null +++ b/maloja/dev/apidebug.py @@ -0,0 +1,28 @@ +import bottle, waitress + +from ..pkg_global.conf import malojaconfig + +from doreah.logging import log +from nimrodel import EAPI as API + + +PORT = malojaconfig["PORT"] +HOST = malojaconfig["HOST"] + +the_listener = API(delay=True) + +@the_listener.get("{path}") +@the_listener.post("{path}") +def all_requests(path,**kwargs): + result = { + 'path':path, + 'payload': kwargs + } + log(result) + return result + + +def run(): + server = bottle.Bottle() + the_listener.mount(server,path="apis") + waitress.serve(server, listen=f"*:{PORT}")