misc
This commit is contained in:
@@ -56,7 +56,8 @@ class KarmaDB:
|
||||
"SELECT keyword, score FROM karma ORDER BY score DESC LIMIT ?", (n,)
|
||||
) as db_cursor:
|
||||
return await db_cursor.fetchall()
|
||||
except:
|
||||
except Exception as e:
|
||||
logging.debug("Exception: %s", str(e))
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
@@ -73,7 +74,7 @@ class KarmaDB:
|
||||
Optional[bool]
|
||||
"""
|
||||
|
||||
if not flag in [0, 1]:
|
||||
if flag not in [0, 1]:
|
||||
return None
|
||||
|
||||
modifier: str = "score + 1" if not flag else "score - 1"
|
||||
@@ -182,7 +183,8 @@ class Karma(FastAPI):
|
||||
},
|
||||
)
|
||||
return JSONResponse(content=top10)
|
||||
except:
|
||||
except Exception as e:
|
||||
logging.debug("Exception: %s", str(e))
|
||||
traceback.print_exc()
|
||||
return JSONResponse(
|
||||
status_code=500,
|
||||
@@ -214,7 +216,8 @@ class Karma(FastAPI):
|
||||
"count": count,
|
||||
}
|
||||
)
|
||||
except:
|
||||
except Exception as e:
|
||||
logging.debug("Exception: %s", str(e))
|
||||
traceback.print_exc()
|
||||
return JSONResponse(
|
||||
status_code=500,
|
||||
@@ -239,7 +242,7 @@ class Karma(FastAPI):
|
||||
):
|
||||
raise HTTPException(status_code=403, detail="Unauthorized")
|
||||
|
||||
if not data.flag in [0, 1]:
|
||||
if data.flag not in [0, 1]:
|
||||
return JSONResponse(
|
||||
status_code=500,
|
||||
content={
|
||||
|
||||
Reference in New Issue
Block a user