File size: 688 Bytes
b9d5fa5 510578f fcf4688 b9d5fa5 fcf4688 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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}")
|