File size: 823 Bytes
848090a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pymongo.mongo_client import MongoClient
from pymongo.server_api import ServerApi

from urllib.parse import quote_plus
username = quote_plus('wrAIteMaster')
password = quote_plus('YqGvfJDUShY5nYu8')


# cluster = 'wraitecluster'
# authSource = '<authSource>'
# authMechanism = '<authMechanism>'
# uri = 'mongodb+srv://' + username + ':' + password + '@' + cluster + '/?authSource=' + authSource + '&authMechanism=' + authMechanism


uri = "mongodb+srv://wrAIteMaster:YqGvfJDUShY5nYu8@wraitecluster.tpqpuj5.mongodb.net/"
# Create a new client and connect to the server
client = MongoClient(uri, server_api=ServerApi('1'))
# Send a ping to confirm a successful connection
try:
    client.admin.command('ping')
    print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
    print(e)