jaothan's picture
Update app.py
510578f verified
raw
history blame contribute delete
688 Bytes
import streamlit as st
from pymongo import MongoClient
import os
import certifi
from pydantic import BaseModel
from typing import List
# Replace with your actual connection string
MONGO_URI = os.getenv("MONGO_URI")
# Connect to MongoDB Atlas
client = MongoClient(MONGO_URI, tls=True, tlsCAFile=certifi.where())
#MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, tls=True, tlscafile='/usr/local/lib/python3.10/site-packages/certifi/cacert.pem')
print(client)
# Test the connection
#try:
# client.admin.command('ping')
# print("Pinged your deployment. You successfully connected to MongoDB!")
#except Exception as e:
# print(f"Error: {e}")