允许您将Notion页面导出为Markdown文件的工具。
项目描述
notion-exporter:将Notion页面导出为Markdown
此Python包允许您通过提供Notion API令牌轻松将Notion页面导出为Markdown。
由于Notion API受到一些速率限制的影响,此工具将自动重试失败的请求,并在重试之前等待速率限制重置。这在导出大量页面时特别有用。此外,此包使用asyncio
进行并行请求,这可以显著加快导出过程。
安装
pip install notion-exporter
使用
from notion_exporter import NotionExporter
exporter = NotionExporter(notion_token="<your-token>")
exported_pages = exporter.export_pages(page_ids=["<list-of-page-ids>"])
# exported_pages will be a dictionary where the keys are the page ids and
# the values are the page content in markdown format
NotionExporter
类接受以下参数
notion_token
:您的Notion API令牌。您可以在Notion的文档中找到有关获取API令牌的信息export_child_pages
:是否递归导出提供的页面ID的所有子页面。默认为False
。extract_page_metadata
:是否从页面提取元数据并将其作为markdown的前置内容添加。提取的元数据包括标题、作者、路径、URL、最后编辑者和页面的最后编辑时间。默认为False
。exclude_title_containing
:如果指定,将排除标题包含此字符串的页面。例如,这可能有助于排除存档的页面。默认为None
。
NotionExporter.export_pages
方法接受以下参数
page_ids
:要导出的页面ID列表。如果export_child_pages
为True
,则还将导出这些页面的所有子页面。database_ids
:要导出的数据库ID列表。如果export_child_pages
为True
,则这些数据库中的所有页面也将被导出。ids_to_exclude
:在递归导出子页面时排除的页面ID列表。如果遇到被排除的页面,其子页面也不会被导出。
项目详情
下载文件
下载适合您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。
源代码分布
notion_exporter-0.1.1.tar.gz (14.5 kB 查看哈希值)
构建分布
notion_exporter-0.1.1-py3-none-any.whl (15.0 kB 查看哈希值)
关闭
notion_exporter-0.1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | e8b9276ec3d934253dd5f386c2e03fdc5c2e2b71c577f114651a7c777140b1ff |
|
MD5 | ad2505caa510fb6926d94ac4421b65b2 |
|
BLAKE2b-256 | 39ba32a10eee4a397f7a8741d1d27ca92f2faafa5ba883fc769343fce469ae5c |
关闭
notion_exporter-0.1.1-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fa9da6fd9e030bc0bd43c5575eaad776f20913283749f5fcfda120bf29eb075b |
|
MD5 | 0eb2ea4b6eaff9871734c01a6ee851b9 |
|
BLAKE2b-256 | b4bf74c8de9ee1f3623232322108b1557ebd94aadb9b392b445286f6015cc312 |