Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from notion_client import Client
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
load_dotenv()
|
7 |
+
|
8 |
+
# 5. Authenticate and Connect to Notion (use notion integration key)
|
9 |
+
notion = Client(auth=os.getenv("NOTION_API_KEY"))
|
10 |
+
|
11 |
+
page_id = '232b178364ed4fa4b15764dbc0d1e9dd'
|
12 |
+
|
13 |
+
response = notion.pages.retrieve(page_id=page_id)
|
14 |
+
|
15 |
+
response_body = notion.blocks.children.list(
|
16 |
+
block_id=page_id
|
17 |
+
)
|
18 |
+
|
19 |
+
st.title(response['properties']['title']['title'][0]['plain_text'])
|
20 |
+
|
21 |
+
for block in response_body['results']:
|
22 |
+
if block['type'] == 'paragraph':
|
23 |
+
for text in block['paragraph']['rich_text']:
|
24 |
+
st.write(text['plain_text'])
|
25 |
+
|