Skip to main content

🔗 Streamlit Notion Connection: Unlock the Power of Notion in Your Data Apps

Effortlessly integrate Notion Connection with your Streamlit apps to enhance data interaction and visualization

Why Streamlit Notion Connection?

As more teams and individuals rely on Notion for project management, note-taking, and collaboration, the ability to seamlessly connect Notion with your data applications becomes invaluable. Streamlit Notion API allows you to effortlessly integrate Notion's powerful API into your Streamlit apps, enabling you to fetch, manipulate, and visualize data from Notion databases and pages. This integration empowers your Streamlit data apps to leverage the rich data stored in Notion, creating more dynamic and interactive user experiences.

Installation

pip install st-notion-connection

Usage

Obtaining Notion API Credentials

To use the Notion API, you need to obtain an API key by creating an integration in the Notion Developer Portal. Follow these steps:

  1. Go to the Notion Developer Portal: Visit Notion Developer Portal.

  2. Create a New Integration:

    • Click on the "New integration" button.
    • Fill in the required details such as name, and select the workspace you want to integrate with.
    • Set the integration type to "Internal Integration".
  3. Save the Integration:

    • Once the integration is created, you will be provided with an "Internal Integration Token". Copy this token.
  4. Add the Integration to Your Workspace:

    • Go to the workspace you selected during integration creation.
    • Click on "Share" in the top-right corner.
    • Add the integration you created to the workspace.

Setting Up the Notion API Key

You can provide the Notion API key in three ways:

  1. As a parameter when creating an instance of NotionConnection.
  2. As a secret in Streamlit's secrets management.
  3. As an environment variable NOTION_API_KEY.

Examples

import streamlit as st
from streamlit_notion import NotionConnection

# Create connection
conn = st.connection("notion", type=NotionConnection)

databases = conn.list_databases()

# st.write(databases)

for database in databases["results"]:
    r = conn.query(database["id"], page_size=1)
    st.write(r)

Methods

  • list_databases(): Lists all databases in the Notion workspace.
  • api(): Returns the Notion client instance.
  • query(database_id, ttl=3600, **kwargs): Queries a Notion database and caches the results for a specified time-to-live (TTL).

Release files for st-notion-connection 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for st-notion-connection 0.0.1
File Size Uploaded
st_notion_connection-0.0.1.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for st-notion-connection 0.0.1
File Interpreter ABI Platform
st_notion_connection-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / st_notion_connection-0.0.1.tar.gz

Download URL st_notion_connection-0.0.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a1ef186f7c4fe94166becccc79c7ce137fec84bfe4b18f744d2096cc6c3f4ac
BLAKE2b-256 checksum
How to use checksums
f7b67725638184b6b72dddaab59e012d3ad64060791bb744f390e3b04390405c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / st_notion_connection-0.0.1-py3-none-any.whl

Download URL st_notion_connection-0.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7696dcd642501c72a11ff27797eb3907e8f57fd9c751f1a7e1413216f27045e
BLAKE2b-256 checksum
How to use checksums
a28424b7819635f2793df22d8c0e262544ec77a19dc625ea3bc6d185fb4f1307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page