from fastapi import APIRouter from fastapi.responses import JSONResponse import sqlite3 from pydantic import BaseModel class DataType(BaseModel): AdminEmail:str AdminPassword:str GetUserRouter=APIRouter(prefix="/Users") @GetUserRouter.post("/GetAllUsers") def adduser(Data:DataType): try: AdminPassword="$2b$12$33H14GFBvtomzLrEaM6Tqu7Jr621eHlXL9TVtdPU6YCljxc4eug2a" if Data.AdminEmail =="Mhammed@Admin.com": if not (Data.AdminPassword==AdminPassword): response=JSONResponse({"Status":False},status_code=200) return response connect=sqlite3.connect("DataBase/DataBase.bd") cursor=connect.execute(f''' SELECT * FROM Users ''') Data=cursor.fetchall() return {"Status":True,"Data":Data} else: response=JSONResponse({"Status":False,"Message":"Email Or password is in corredct try to login again"},status_code=200) return response except Exception as e: return {"Status":False,"Message":e}