Notion_Manager / app.py
Sakalya122's picture
Upload 6 files
850ca63 verified
Raw
History Blame Contribute Delete
1.19 kB
import streamlit as st
import pandas as pd
from notion import add_to_notion, fetch_notion_data
st.set_page_config(page_title="Notion Database Manager", layout="wide")
# Sidebar for navigation
st.sidebar.title("Navigation")
page = st.sidebar.radio("Select a page:", ["Update Database", "View Database Entries"])
if page == "Update Database":
st.title("Notion Database Updater")
# Input section
source = st.text_input("Enter Source:")
url = st.text_input("Enter URL:")
if st.button("Submit"):
if source and url:
success = add_to_notion(source, url)
if success:
st.success("Data added successfully!")
else:
st.error("Failed to add data. Please check your inputs.")
else:
st.warning("Please fill in both fields.")
elif page == "View Database Entries":
st.title("View Notion Database Entries")
if st.button("Load Entries"):
entries = fetch_notion_data()
if entries:
st.subheader("Database Entries:")
df = pd.DataFrame(entries)
st.dataframe(df)
else:
st.info("No entries found in the database.")