Spaces:
Sleeping
Sleeping
import streamlit as st | |
import json | |
import uuid | |
import os | |
from pymongo import MongoClient | |
# uri = os.environ["MONGO_CONNECTION_STRING"] | |
uri = "mongodb+srv://cluster0.j2p0gjo.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority" | |
client = MongoClient(uri,tlsCertificateKeyFile= "cert.pem") | |
db = client["mydata"] | |
col = db["Reminders"] | |
def rem(): | |
st.title("Reminders") | |
st.subheader("Enter reminder details:") | |
remid =str(uuid.uuid4()) | |
remsg =st.text_input("Enter Reminder Message:") | |
remtime = str(st.time_input("Enter Reminder Time:")) | |
remdate = str(st.date_input("Enter Reminder Date:")) | |
repeat =st.selectbox( | |
" would you like to repeat Reminder:",["No","daily","weekly","yearly"] | |
) | |
reminder ={ | |
"id": remid, | |
"message": remsg, | |
"time": remtime, | |
"date": remdate, | |
"repeat": repeat, | |
"status": False, | |
} | |
if st.button("Save"): | |
col.insert_one(reminder) | |