Skip to main content

notion-exporter: Export Notion pages to Markdown

This python package allows you to easily export your Notion pages to Markdown by providing a Notion API token.

Given that the Notion API is subject to some rate limits, this tool will automatically retry failed requests and wait for the rate limit to reset before retrying. This is especially useful when exporting a large number of pages. Furthermore, this package uses asyncio to make requests in parallel, which can significantly speed up the export process.

Installation

pip install notion-exporter

Usage

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

The NotionExporter class takes the following arguments:

  • notion_token: Your Notion API token. You can find information on how to get an API token in Notion's documentation
  • export_child_pages: Whether to recursively export all child pages of the provided page ids. Defaults to False.
  • extract_page_metadata: Whether to extract metadata from the page and add it as a frontmatter to the markdown. Extracted metadata includes title, author, path, URL, last editor, and last editing time of the page. Defaults to False.
  • exclude_title_containing: If specified, pages with titles containing this string will be excluded. This might be useful for example to exclude pages that are archived. Defaults to None.

The NotionExporter.export_pages method takes the following arguments:

  • page_ids: A list of page ids to export. If export_child_pages is True, all child pages of these pages will be exported as well.
  • database_ids: A list of database ids to export. If export_child_pages is True, all pages in these databases will be exported as well.
  • ids_to_exclude: A list of page ids to exclude when recursively exporting child pages. If an excluded page is encountered, its child pages will not be exported either.

Release files for notion-exporter 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for notion-exporter 0.1.1
File Size Uploaded
notion_exporter-0.1.1.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for notion-exporter 0.1.1
File Interpreter ABI Platform
notion_exporter-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / notion_exporter-0.1.1.tar.gz

Download URL notion_exporter-0.1.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e8b9276ec3d934253dd5f386c2e03fdc5c2e2b71c577f114651a7c777140b1ff
BLAKE2b-256 checksum
How to use checksums
39ba32a10eee4a397f7a8741d1d27ca92f2faafa5ba883fc769343fce469ae5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Release files / notion_exporter-0.1.1-py3-none-any.whl

Download URL notion_exporter-0.1.1-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa9da6fd9e030bc0bd43c5575eaad776f20913283749f5fcfda120bf29eb075b
BLAKE2b-256 checksum
How to use checksums
b4bf74c8de9ee1f3623232322108b1557ebd94aadb9b392b445286f6015cc312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page