Update.
All checks were successful
Build Base Application / Build (push) Successful in 1m38s

This commit is contained in:
retoor 2024-12-03 23:30:11 +01:00
parent 7e040bb70a
commit dae7bc720b
5 changed files with 13 additions and 12 deletions

Binary file not shown.

BIN
dist/app-1.0.0.tar.gz vendored

Binary file not shown.

View File

@ -38,7 +38,7 @@ class BaseApplication(web.Application):
super().__init__(*args, **kwargs)
def run(self, *args, **kwargs):
web.run_app(self,*args,**kwargs)
web.run_app(self, *args, **kwargs)
async def authenticate(self, username, password):
return self.username == username and self.password == password
@ -122,9 +122,9 @@ class WebDbApplication(BaseApplication):
self.router.add_post("/db/get", self.get_handler)
self.router.add_post("/db/set", self.set_handler)
async def set_handler(self,request):
async def set_handler(self, request):
obj = await request.json()
response = await self.set(obj.get("key"),obj.get("value"))
response = await self.set(obj.get("key"), obj.get("value"))
return web.json_response(response)
async def get_handler(self, request):

View File

@ -30,7 +30,7 @@ async def bench(url):
while True:
index += 1
try:
async with session.get(url.rstrip("/") + "/stat") as response:
async with session.get(url.rstrip("/") + "/stat"):
pass
time_end = time.time()
duration = time_end - time_start
@ -39,7 +39,10 @@ async def bench(url):
except Exception as ex:
log.exception(ex)
await asyncio.sleep(1)
log.info("{} requests per second. Made {} requests in total in duration of {} seconds.".format(index/duration_limit,index,duration))
log.info(
f"{index / duration_limit} requests per second. Made {index} requests in total in duration of {duration} seconds."
)
def cli_bench():
args = parse_args()

View File

@ -2,15 +2,13 @@ from IPython.terminal.embed import InteractiveShellEmbed
def repl(**kwargs):
from .app import Application
variables = {}
variables.update(globals().copy())
variables.update(locals())
variables.update(kwargs)
shell = InteractiveShellEmbed(
exit_msg="Exiting..."
)
shell = InteractiveShellEmbed(exit_msg="Exiting...")
shell(local_ns=variables)