from oneaccount import OneAccount
# Any engine could be used instead of RedisEngine that
# implements the set and get methods
# oneaccount from with an InMemoryEngine
# for local development or for small services
# for large services it is highly recommended to use
# redis or any other persisting database engine
oa = OneAccount(RedisEngine())
@router.post("/oneaccountauth", status_code=status.HTTP_200_OK)
async def oneaccount_auth(request: Request):
unauthorized_errror = JSONResponse(
status_code=status.HTTP_401_UNAUTHORIZED,
content={"success": False}
data = await oa.auth(request)
return unauthorized_errror
return unauthorized_errror
self.client = redis.Redis(host='localhost', port=6379, db=0)
def set(self, key: str, value: str) -> None:
self.client.set(key, value)
def get(self, key: str) -> str:
data = self.client.get(key)