Deema commited on
Commit
489c84c
·
verified ·
1 Parent(s): 60b18e1

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +4 -1
database.py CHANGED
@@ -1,6 +1,9 @@
1
  from pymongo import MongoClient
 
2
  import os
3
 
 
 
4
  # CER_KEY = os.environ['cer']
5
 
6
  # uri = "mongodb+srv://cluster0.tzvxqk3.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority"
@@ -15,7 +18,7 @@ import os
15
 
16
  from pymongo.mongo_client import MongoClient
17
 
18
- uri = f"mongodb+srv://deema2:{os.environ['pw']}@cluster0.tzvxqk3.mongodb.net/?retryWrites=true&w=majority"
19
 
20
  # Create a new client and connect to the server
21
  client = MongoClient(uri)
 
1
  from pymongo import MongoClient
2
+ from urllib.parse import quote_plus
3
  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"
 
18
 
19
  from pymongo.mongo_client import MongoClient
20
 
21
+ uri = f"mongodb+srv://deema2:{password}@cluster0.tzvxqk3.mongodb.net/?retryWrites=true&w=majority"
22
 
23
  # Create a new client and connect to the server
24
  client = MongoClient(uri)