1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added API debug feature

This commit is contained in:
krateng 2022-05-01 22:39:16 +02:00
parent c16919eb1e
commit 81f4e35258
2 changed files with 30 additions and 1 deletions

View File

@ -14,7 +14,7 @@ from . import __pkginfo__ as pkginfo
from .pkg_global import conf from .pkg_global import conf
from .proccontrol import tasks from .proccontrol import tasks
from .setup import setup 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 "backup":tasks.backup, # maloja backup --targetfolder /x/y --include_images
"generate":generate.generate_scrobbles, # maloja generate 400 "generate":generate.generate_scrobbles, # maloja generate 400
"export":tasks.export, # maloja export "export":tasks.export, # maloja export
"apidebug":apidebug.run, # maloja apidebug
# aux # aux
"info":print_info "info":print_info
} }

28
maloja/dev/apidebug.py Normal file
View File

@ -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}")