from supabase import Client, create_client from dotenv import load_dotenv import os load_dotenv() # service url URL = os.getenv("SUPABASE_IP") # service key KEY = os.getenv("SUPABASE_KEY") class supaClient: def __init__(self): self.client = create_client(URL, KEY) # logger def logger(dbclient: Client, args: list): if args[0] == "newpost": hash:str = args[1] pres = dbclient.table("niming_posts").select("id, hash").eq("hash", hash).execute() id = int(pres.data[0]["id"]) dbres = dbclient.table("niming_log").insert({ "message": "[id=%d] new post"%id, "source": "client" }).execute() return dbres return None