rwitz commited on
Commit
d51f0d6
1 Parent(s): c25a9e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -9,10 +9,14 @@ enable_btn = gr.Button.update(interactive=True)
9
 
10
  import sqlite3
11
 
12
- import pymongo
 
 
13
  password=os.environ.get("MONGODB")
 
14
  def init_database():
15
- client = pymongo.MongoClient(f"mongodb+srv://new-user:{password}@cluster0.xb2urf6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0")
 
16
  db = client["elo_ratings"]
17
  collection = db["elo_ratings"]
18
  return collection
 
9
 
10
  import sqlite3
11
 
12
+ from pymongo.mongo_client import MongoClient
13
+ from pymongo.server_api import ServerApi
14
+
15
  password=os.environ.get("MONGODB")
16
+
17
  def init_database():
18
+ uri = f"mongodb+srv://new-user:{password}@cluster0.xb2urf6.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
19
+ client = MongoClient(uri, server_api=ServerApi('1'))
20
  db = client["elo_ratings"]
21
  collection = db["elo_ratings"]
22
  return collection