Spaces:
Runtime error
Runtime error
Update database.py
Browse files- database.py +1 -27
database.py
CHANGED
@@ -4,39 +4,13 @@ import os
|
|
4 |
|
5 |
password = quote_plus(os.environ['pw'])
|
6 |
|
7 |
-
# CER_KEY = os.environ['cer']
|
8 |
-
|
9 |
-
# uri = "mongodb+srv://cluster0.tzvxqk3.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority"
|
10 |
-
# client = MongoClient(uri,
|
11 |
-
# tls=True,
|
12 |
-
# tlsCertificateKeyFile=CER_KEY)
|
13 |
-
|
14 |
-
# db = client['testDB']
|
15 |
-
# collection = db['testCol']
|
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 |
|
|
|
4 |
|
5 |
password = quote_plus(os.environ['pw'])
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
uri = f"mongodb+srv://cidar:{password}@cluster0.yuhfxcj.mongodb.net/?retryWrites=true&w=majority"
|
8 |
|
9 |
# Create a new client and connect to the server
|
10 |
client = MongoClient(uri)
|
11 |
db = client['testDB']
|
12 |
collection = db['testCol']
|
13 |
+
|
14 |
def save_response(response_data):
|
15 |
"""Saves a response to the MongoDB collection."""
|
16 |
|