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:
parent
c16919eb1e
commit
81f4e35258
@ -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
|
||||
}
|
||||
|
28
maloja/dev/apidebug.py
Normal file
28
maloja/dev/apidebug.py
Normal 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}")
|
Loading…
Reference in New Issue
Block a user