Metadata-Version: 2.1
Name: notionai-py
Version: 0.0.2
Summary: Unoffical Notion AI API
Author-email: Vaayne <liu.vaayne@gmail.com>
License: MIT License
Project-URL: Homepage, https://github.com/Vaayne/NotionAI
Project-URL: Bug Tracker, https://github.com/Vaayne/NotionAI/issues
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENSE

# NotionAI
Unofficial NotionAI API

https://github.com/Vaayne/NotionAI

## Feature

- Full APIs from Notion AI
- Support stream response

## Usage

### Install

```
pip install --upgrade notionai-py
```

### Get Notion Token

1. Open Chrome / Firefix DevTools
2. Find Cookies and copy value for `token_v2`

![](./docs/images/get_notion_token.png)

### Example

#### Basic

```python
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

```python
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()
```
