A package to interact with the Notion API
Project description
SecNex Notion API Wrapper
This is a wrapper for the Notion API. You can use it to create, update, and delete pages, blocks, and more.
Features
Pages
- Create a page
- Search for pages
- Get a page by id
- Update a page
- Delete a page
Blocks
- Create a block
Installation
pip install secnex-notion-api
Usage
from secnex_notion_api.api.client import NotionApiClient
from secnex_notion_api.page import NotionPage
from secnex_notion_api.block import NotionParagraph
import os
client = NotionApiClient(token=os.getenv("NOTION_API_KEY"))
def main():
pages = client.search(query="Site Name", filter={"value": "page", "property": "object"})
print(pages)
page_id = pages["results"][0]["id"]
print(page_id)
page = client.get_page_by_id(page_id)
print(page)
paragraph = NotionParagraph(parent_type="page", text=["Hello, world!"])
page = NotionPage(parent={"page_id": page_id}, title="Hello, world!", blocks=[paragraph], properties=pages["results"][0]["properties"])
print(page)
print(client.new(page))
if __name__ == "__main__":
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secnex_notion_api-0.0.5.tar.gz.
File metadata
- Download URL: secnex_notion_api-0.0.5.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aafe367241a7cd4adebc5c31192bd800c515ec7967c6ff8d21bc5cb9fef9f97e
|
|
| MD5 |
2f9df5c66ecb0c0fb2bfdb18228b6b19
|
|
| BLAKE2b-256 |
53104db29ae804369fb2a761b99c296924afb014c3c438db6a7182dd21fa7293
|
File details
Details for the file secnex_notion_api-0.0.5-py3-none-any.whl.
File metadata
- Download URL: secnex_notion_api-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547172369c8a2e3999c47e8896e33bdf0b09bd17704603f2e76070de9e57b7b5
|
|
| MD5 |
876658313cfa88920715145fb7b41d62
|
|
| BLAKE2b-256 |
5e324a350abafd4e415bada468caf465053755d5f52ed3358b74e87efe4ae4dd
|