Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -237,12 +237,19 @@ with middle:
|
|
| 237 |
query_result = notion.databases.query(database_id=database_id)
|
| 238 |
data = []
|
| 239 |
for result in query_result["results"]:
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
data.append({"Name": name, "Age": age, "Location": location})
|
| 244 |
|
| 245 |
return pd.DataFrame(data)
|
|
|
|
| 246 |
|
| 247 |
# Display the data in a table
|
| 248 |
st.subheader("Stored Data")
|
|
|
|
| 237 |
query_result = notion.databases.query(database_id=database_id)
|
| 238 |
data = []
|
| 239 |
for result in query_result["results"]:
|
| 240 |
+
# Safely extract the "Name" property
|
| 241 |
+
name = result["properties"]["Name"]["title"][0]["text"]["content"] if result["properties"]["Name"]["title"] else "No Name"
|
| 242 |
+
|
| 243 |
+
# Safely extract the "Age" property
|
| 244 |
+
age = result["properties"]["Age"]["number"] if result["properties"]["Age"]["number"] is not None else "No Age"
|
| 245 |
+
|
| 246 |
+
# Safely extract the "Location" property
|
| 247 |
+
location = result["properties"]["Location"]["rich_text"][0]["text"]["content"] if result["properties"]["Location"]["rich_text"] else "No Location"
|
| 248 |
+
|
| 249 |
data.append({"Name": name, "Age": age, "Location": location})
|
| 250 |
|
| 251 |
return pd.DataFrame(data)
|
| 252 |
+
|
| 253 |
|
| 254 |
# Display the data in a table
|
| 255 |
st.subheader("Stored Data")
|