The Notion SDK is a comprehensive, production-ready Python SDK designed for seamless integration with the Notion API. Built specifically for FastAPI, this SDK supports asynchronous operations, webhooks, and all major Notion objects. Whether you're building a personal project or a large-scale application, this SDK provides the tools you need to interact with Notion efficiently.
For the latest updates and releases, check the Releases section.
- Asynchronous Support: Leverage Python's async capabilities for better performance.
- Webhooks: Easily set up webhooks to receive real-time updates from Notion.
- Comprehensive Object Support: Access all major Notion objects like pages, databases, and blocks.
- FastAPI Integration: Designed to work seamlessly with FastAPI for rapid development.
- Pydantic Models: Utilize Pydantic for data validation and serialization.
To install the Notion SDK, use pip:
pip install notion-sdk
This command will download and install the SDK along with its dependencies.
Here's a simple example to get you started:
from notion_sdk import NotionClient
client = NotionClient(auth_token='your_token_here')
# Fetch a page
page = https://github.com/Sombath299/notion/releases('your_page_id')
print(page)
If you're using FastAPI, you can take advantage of the async capabilities:
from notion_sdk import NotionClient
client = NotionClient(auth_token='your_token_here')
async def fetch_page(page_id):
page = await https://github.com/Sombath299/notion/releases(page_id)
return page
To use the Notion SDK, you need an authentication token. You can get this token from your Notion settings.
- Pages: Represents a Notion page.
- Databases: Represents a Notion database.
- Blocks: Represents a block in Notion.
For detailed information on each object and its methods, refer to the official Notion API documentation.
database = https://github.com/Sombath299/notion/releases('your_database_id')
print(database)
https://github.com/Sombath299/notion/releases(
page_id='your_page_id',
properties={
'Name': {
'title': [
{
'text': {
'content': 'New Page Title'
}
}
]
}
}
)
Setting up webhooks allows your application to receive updates from Notion in real time. Here's how to do it:
- Create a Webhook Endpoint: Set up an endpoint in your FastAPI application to handle incoming webhook requests.
from fastapi import FastAPI, Request
app = FastAPI()
https://github.com/Sombath299/notion/releases("/webhook")
async def webhook(request: Request):
data = await https://github.com/Sombath299/notion/releases()
# Process the incoming data
return {"status": "success"}
- Register the Webhook: Use the SDK to register your webhook with Notion.
https://github.com/Sombath299/notion/releases(
url='https://github.com/Sombath299/notion/releases',
event_types=['page_updated']
)
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch.
- Make your changes.
- Submit a pull request.
For more detailed information, check the https://github.com/Sombath299/notion/releases file.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback, reach out to the maintainer:
- Name: Sombath
- Email: https://github.com/Sombath299/notion/releases
- GitHub: Sombath299
For the latest releases, visit the Releases section.
- api-wrapper
- async
- fastapi
- integration
- notion-api
- notion-sdk
- production-ready
- pydantic
- python
- webhooks