Spaces:
Runtime error
Runtime error
Update database.py
Browse files- database.py +14 -3
database.py
CHANGED
|
@@ -16,16 +16,27 @@ password = quote_plus(os.environ['pw'])
|
|
| 16 |
|
| 17 |
###
|
| 18 |
|
| 19 |
-
from pymongo.mongo_client import MongoClient
|
| 20 |
|
| 21 |
-
uri = f"mongodb+srv://deemaa2:{password}@cluster0.tzvxqk3.mongodb.net/?retryWrites=true&w=majority"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Create a new client and connect to the server
|
| 24 |
client = MongoClient(uri)
|
| 25 |
db = client['testDB']
|
| 26 |
collection = db['testCol']
|
| 27 |
###
|
| 28 |
-
|
| 29 |
def save_response(response_data):
|
| 30 |
"""Saves a response to the MongoDB collection."""
|
| 31 |
|
|
|
|
| 16 |
|
| 17 |
###
|
| 18 |
|
| 19 |
+
# from pymongo.mongo_client import MongoClient
|
| 20 |
|
| 21 |
+
# uri = f"mongodb+srv://deemaa2:{password}@cluster0.tzvxqk3.mongodb.net/?retryWrites=true&w=majority"
|
| 22 |
+
|
| 23 |
+
# # Create a new client and connect to the server
|
| 24 |
+
# client = MongoClient(uri)
|
| 25 |
+
# db = client['testDB']
|
| 26 |
+
# collection = db['testCol']
|
| 27 |
+
###
|
| 28 |
+
|
| 29 |
+
# name = quote_plus('cidar')
|
| 30 |
+
# password = quote_plus("cidar$2024")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
uri = f"mongodb+srv://cidar:{password}@cluster0.yuhfxcj.mongodb.net/?retryWrites=true&w=majority"
|
| 34 |
|
| 35 |
# Create a new client and connect to the server
|
| 36 |
client = MongoClient(uri)
|
| 37 |
db = client['testDB']
|
| 38 |
collection = db['testCol']
|
| 39 |
###
|
|
|
|
| 40 |
def save_response(response_data):
|
| 41 |
"""Saves a response to the MongoDB collection."""
|
| 42 |
|