Unoffical Notion AI API
Project description
NotionAI
Unofficial NotionAI API
https://github.com/Vaayne/NotionAI
Feature
- Full APIs from Notion AI
- Support stream response
API
We support all NotionAI's functionalites. You can find all the APIs in NotionAI.py
Basic API Shortcuts
APIs like blog_post, help_me_write, help_me_edit, summarize ... are shortcuts for the basic APIs.
Advanced APIs
Some times we don't want to call apis one by one, we want to dispatch by parameters, these are advanced APIs.
We support these advanced APIs:
writing_with_topic
writing_with_prompt
Usage
Install
pip install --upgrade notionai-py
Get Notion Token
- Open Chrome / Firefix DevTools
- Find Cookies and copy value for
token_v2
Example
Basic
import os
from notionai import NotionAI
TOKEN = os.getenv("NOTION_TOKEN")
def main():
ai = NotionAI(TOKEN)
res = ai.blog_post("write a blog about the meaning of life")
print(res)
if __name__ == "__main__":
main()
Stream API
import os
import sys
from notionai import NotionAI
TOKEN = os.getenv("NOTION_TOKEN")
def main():
ai = NotionAIStream(TOKEN)
res = ai.blog_post("write a blog about the meaning of life")
for item in res:
sys.stdout.write(item)
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
notionai-py-0.0.4.tar.gz
(275.0 kB
view hashes)
Built Distribution
Close
Hashes for notionai_py-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18c01e27f957a8f914ee9bfe6b81990d86956bd8303695804bd735647d583ab1 |
|
MD5 | ece17d897ffec87493b77e629e6aebfa |
|
BLAKE2b-256 | 3ff948e8212a5b1aa902b962eb33745d8f80d3425137b6ea9afb7cdecc5b52f2 |