Upload image in page
Tags: #notion #upload #image #page #snippet #naas_drivers
Last update: 2023-04-28 (Created: 2023-04-28)
Description: This notebook explains how to upload an image in a Notion page using naas_drivers. It is usefull for organizations that need to add visuals to their Notion pages.
References:
from naas_drivers import notion
import naas
image_url
: Image URLnotion_token
: Notion token shared with your databasepage_url
: Notion page URL or ID
# Inputs
image_url = "https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png"
# Outputs
notion_token = naas.secret.get("NOTION_TOKEN") or "YOUR_TOKEN"
page_url = "https://www.notion.so/naas-official/Test-93655d0408c14923bcd305dd4599cda9?pvs=4"
page_id = page_url.split("/")[-1].split("?")[0].split("-")[-1]
page = notion.connect(notion_token).page.get(page_id)
page.image(image_url)
page.update()
print("Image uploaded in your page:", page_url)
Last modified 1mo ago