Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it? #1

Open
Errolll opened this issue Jan 26, 2024 · 3 comments
Open

How to use it? #1

Errolll opened this issue Jan 26, 2024 · 3 comments

Comments

@Errolll
Copy link

Errolll commented Jan 26, 2024

No description provided.

@zzangho
Copy link
Owner

zzangho commented Jan 26, 2024

  1. Register notion API and get a notion API token from notion API center
  2. Embed your registered API on the page you want to modify, you can embed it in the page options (can access via top right corner)
  3. Get a page id by copying page url
  4. Paste the API token (from 1) and the page id (from 3) onto the source code. they are annotated like (your api token here...) or (your page id here...)
  5. install the required python package imported in the source code
  6. run it and wait until the operation is finished

@Errolll
Copy link
Author

Errolll commented Jan 26, 2024

Screenshot 2024-01-26 at 19 49 45 Just like this? But where should I install the package to? And how to run it?

@zzangho
Copy link
Owner

zzangho commented Jan 27, 2024

No, you have to use your notion token. You can get it from your notion API center.
After you get the API token, please replace the annotated line in the source code with your API token.

in the main.py

import os
from notion_client import Client
from functions import convert_eq, convert_inline_eq

if __name__ == '__main__':
    
    # ex: os.environ["NOTION_TOKEN"] = "secret_***"
    os.environ["NOTION_TOKEN"] = "<YOUR NOTION TOKEN>"
    
    notion = Client(auth=os.environ["NOTION_TOKEN"])
    
    page_id = '<YOUR PAGE ID>'
    
    
    _blocks = list()
    
    has_more = True
    
    cursor_id = None

    ...

Replace <YOUR NOTION TOKEN> with your notion API token and <YOUR PAGE ID> with your page ID.
, and run the main.py with the Python command.

This tutorial could help you understand how to run the Python code with notion API.

https://www.youtube.com/watch?v=M1gu9MDucMA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants