Spaces:
Sleeping
Sleeping
| from astrapy import DataAPIClient | |
| xforce_bcl_endpoint="https://b3cc3888-098f-45f7-9087-260ed43b742c-us-east-2.apps.astra.datastax.com" | |
| xforce_bcl_db_token="AstraCS:dRZIxPSXJqqWPPgJjMpoqnrJ:999c021256da787c45f0309e589c9e99884c6559a9337d09de9fa15cd88843dc" | |
| client = DataAPIClient(xforce_bcl_db_token) | |
| db = client.get_database_by_api_endpoint(xforce_bcl_endpoint) | |
| coll="app" | |
| class DatabaseEngine(): | |
| def __init__(self): | |
| pass | |
| def Insert(self,data): | |
| collection=db.get_collection(coll) | |
| result = collection.insert_one(data) | |
| return result | |
| def Login(self,data): | |
| collection=db.get_collection(coll) | |
| result =collection.find_one({"username":data["username"],"password":data["password"]}) | |
| if result is not None: | |
| return True | |
| else: | |
| return False |