from deta import Deta # pip3 install deta import os from dotenv import load_dotenv ## pip3 install python-dotenv DETA_KEY = "c0zegv33efm_4MBTaoQAn76GzUfsZeKV64Uh9qMY3WZb" # load_dotenv(".env") # DETA_KEY = os.getenv("DETA_KEY") # print(DETA_KEY) deta = Deta(DETA_KEY) # mybase is the name of the database in Deta. You can change it to any name you want. db = deta.Base("mybase") # print(db) #* 目前我的mybase中有一個key是一个临时字符串。 def insert_user(username, name, password): return db.put({"key": username, "name": name, "password": password}) ## username is the key, a unique identifier. def fetch_all_users(): res = db.fetch() return res.items all_users = fetch_all_users() print(all_users) def get_user(username): return db.get(username) def update_user(username, name, password): return db.put({"key": username, "name": name, "password": password}) def delete_user(username): return db.delete(username)