deema commited on
Commit
c3e3539
·
1 Parent(s): 3b53056
Files changed (1) hide show
  1. database.py +5 -3
database.py CHANGED
@@ -1,12 +1,15 @@
1
  from pymongo.mongo_client import MongoClient
2
- from pymongo.server_api import ServerApi
3
  from urllib.parse import quote_plus
 
 
4
 
5
  password = quote_plus('cidar@2024$')
6
  uri = f"mongodb+srv://deemaa2:{password}@cluster0.qjruxcb.mongodb.net/?retryWrites=true&w=majority"
7
 
8
  # Create a new client and connect to the server
9
- client = MongoClient(uri, server_api=ServerApi('1'))
 
10
 
11
  # Specify the database and collection
12
  db = client.your_database_name
@@ -22,7 +25,6 @@ def save_response(response_data):
22
  print(f"An error occurred: {e}")
23
  exit(0)
24
 
25
-
26
  def read_responses(filter_query=None):
27
  """Reads responses from the MongoDB collection based on an optional filter."""
28
  try:
 
1
  from pymongo.mongo_client import MongoClient
2
+ # from pymongo.server_api import ServerApi
3
  from urllib.parse import quote_plus
4
+ import ssl
5
+
6
 
7
  password = quote_plus('cidar@2024$')
8
  uri = f"mongodb+srv://deemaa2:{password}@cluster0.qjruxcb.mongodb.net/?retryWrites=true&w=majority"
9
 
10
  # Create a new client and connect to the server
11
+ # client = MongoClient(uri, server_api=ServerApi('1'))
12
+ client = MongoClient(uri, ssl_cert_reqs=ssl.CERT_NONE)
13
 
14
  # Specify the database and collection
15
  db = client.your_database_name
 
25
  print(f"An error occurred: {e}")
26
  exit(0)
27
 
 
28
  def read_responses(filter_query=None):
29
  """Reads responses from the MongoDB collection based on an optional filter."""
30
  try: