|
from deta import Deta |
|
import os |
|
from dotenv import load_dotenv |
|
|
|
DETA_KEY = "c0zegv33efm_4MBTaoQAn76GzUfsZeKV64Uh9qMY3WZb" |
|
|
|
|
|
|
|
|
|
deta = Deta(DETA_KEY) |
|
|
|
|
|
db = deta.Base("mybase") |
|
|
|
|
|
|
|
def insert_user(username, name, password): |
|
return db.put({"key": username, "name": name, "password": password}) |
|
|
|
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) |
|
|
|
|