Skip to content

Commit 1dd89c4

Browse files
Merge pull request #271 from adamtheturtle/only-upload-new-blocks
Make upload script output more useful - show URL
2 parents 38849e4 + 0040466 commit 1dd89c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/_notion_scripts/upload.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ def main(
154154
(page,) = pages_matching_title
155155
else:
156156
page = session.create_page(parent=parent, title=title)
157-
sys.stdout.write(f"Created new page: {title} (ID: {page.id})\n")
157+
sys.stdout.write(f"Created new page: {title} ({page.url})\n")
158158

159159
if icon:
160160
page.icon = Emoji(emoji=icon)
161161

162-
for child in page.children:
163-
child.delete()
164-
165162
block_objs = [
166163
_block_from_details(details=details, session=session)
167164
for details in blocks
168165
]
169166

167+
for child in page.children:
168+
child.delete()
169+
170170
page.append(blocks=block_objs)
171-
sys.stdout.write(f"Updated existing page: {title} (ID: {page.id})\n")
171+
sys.stdout.write(f"Updated existing page: {title} ({page.url})\n")

0 commit comments

Comments
 (0)