1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00

Add some debug logging to the table class

This commit is contained in:
kaiyou 2018-09-26 17:44:55 +02:00 committed by Alexander Graf
parent d640da8787
commit 81d171f978
No known key found for this signature in database
GPG Key ID: B8A9DC143E075629

View File

@ -19,17 +19,20 @@ class UrlTable(object):
async def get(self, key, ns=None):
""" Get the given key in the provided namespace
"""
logging.debug("Table get {}".format(key))
if ns is not None:
key += "/" + ns
async with aiohttp.ClientSession() as session:
async with session.get(self.url_pattern.format(key)) as request:
if request.status == 200:
result = await request.json()
logging.debug("Table get {} is {}".format(key, result))
return result
async def set(self, key, value, ns=None):
""" Set a value for the given key in the provided namespace
"""
logging.debug("Table set {} to {}".format(key, value))
if ns is not None:
key += "/" + ns
async with aiohttp.ClientSession() as session:
@ -38,6 +41,7 @@ class UrlTable(object):
async def iter(self, cat):
""" Iterate the given key (experimental)
"""
logging.debug("Table iter {}".format(cat))
async with aiohttp.ClientSession() as session:
async with session.get(self.url_pattern.format(cat)) as request:
if request.status == 200: