notion-exporter


Namenotion-exporter JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryTool that allows you to export your Notion pages to markdown files.
upload_time2023-09-26 20:01:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords notion notion-api notion-export notion-extraction
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://developers.notion.com/reference/request-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

```bash
pip install notion-exporter
```

## Usage

```python
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](https://developers.notion.com/docs/create-a-notion-integration)
- `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.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "notion-exporter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "Notion,Notion-API,Notion-Export,Notion-Extraction",
    "author": null,
    "author_email": "Bogdan Kosti\u0107 <bogdankostic@web.de>",
    "download_url": "https://files.pythonhosted.org/packages/39/ba/32a10eee4a397f7a8741d1d27ca92f2faafa5ba883fc769343fce469ae5c/notion_exporter-0.1.1.tar.gz",
    "platform": null,
    "description": "# notion-exporter: Export Notion pages to Markdown\n\nThis python package allows you to easily export your Notion pages to Markdown by providing a Notion API token.\n\nGiven that the Notion API is subject to some [rate limits](https://developers.notion.com/reference/request-limits),\nthis tool will automatically retry failed requests and wait for the rate limit to reset before retrying. This is\nespecially useful when exporting a large number of pages. Furthermore, this package uses `asyncio` to make requests in\nparallel, which can significantly speed up the export process.\n\n## Installation\n\n```bash\npip install notion-exporter\n```\n\n## Usage\n\n```python\nfrom notion_exporter import NotionExporter\n\nexporter = NotionExporter(notion_token=\"<your-token>\")\nexported_pages = exporter.export_pages(page_ids=[\"<list-of-page-ids>\"])\n\n# exported_pages will be a dictionary where the keys are the page ids and \n# the values are the page content in markdown format\n```\n\nThe `NotionExporter` class takes the following arguments:\n- `notion_token`: Your Notion API token. You can find information on how to get an API token in [Notion's documentation](https://developers.notion.com/docs/create-a-notion-integration)\n- `export_child_pages`: Whether to recursively export all child pages of the provided page ids. Defaults to `False`.\n- `extract_page_metadata`: Whether to extract metadata from the page and add it as a frontmatter to the markdown. \n                           Extracted metadata includes title, author, path, URL, last editor, and last editing time of \n                           the page. Defaults to `False`.\n- `exclude_title_containing`: If specified, pages with titles containing this string will be excluded. This might be\n                              useful for example to exclude pages that are archived. Defaults to `None`.\n\nThe `NotionExporter.export_pages` method takes the following arguments:\n- `page_ids`: A list of page ids to export. If `export_child_pages` is `True`, all child pages of these pages will be\n              exported as well.\n- `database_ids`: A list of database ids to export. If `export_child_pages` is `True`, all pages in these databases\n                  will be exported as well.\n- `ids_to_exclude`: A list of page ids to exclude when recursively exporting child pages. If an excluded page is\n                    encountered, its child pages will not be exported either.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tool that allows you to export your Notion pages to markdown files.",
    "version": "0.1.1",
    "project_urls": {
        "GitHub": "https://github.com/bogdankostic/notion-exporter"
    },
    "split_keywords": [
        "notion",
        "notion-api",
        "notion-export",
        "notion-extraction"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b4bf74c8de9ee1f3623232322108b1557ebd94aadb9b392b445286f6015cc312",
                "md5": "0eb2ea4b6eaff9871734c01a6ee851b9",
                "sha256": "fa9da6fd9e030bc0bd43c5575eaad776f20913283749f5fcfda120bf29eb075b"
            },
            "downloads": -1,
            "filename": "notion_exporter-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0eb2ea4b6eaff9871734c01a6ee851b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 15017,
            "upload_time": "2023-09-26T20:01:33",
            "upload_time_iso_8601": "2023-09-26T20:01:33.260373Z",
            "url": "https://files.pythonhosted.org/packages/b4/bf/74c8de9ee1f3623232322108b1557ebd94aadb9b392b445286f6015cc312/notion_exporter-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "39ba32a10eee4a397f7a8741d1d27ca92f2faafa5ba883fc769343fce469ae5c",
                "md5": "ad2505caa510fb6926d94ac4421b65b2",
                "sha256": "e8b9276ec3d934253dd5f386c2e03fdc5c2e2b71c577f114651a7c777140b1ff"
            },
            "downloads": -1,
            "filename": "notion_exporter-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ad2505caa510fb6926d94ac4421b65b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14474,
            "upload_time": "2023-09-26T20:01:32",
            "upload_time_iso_8601": "2023-09-26T20:01:32.086152Z",
            "url": "https://files.pythonhosted.org/packages/39/ba/32a10eee4a397f7a8741d1d27ca92f2faafa5ba883fc769343fce469ae5c/notion_exporter-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-26 20:01:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bogdankostic",
    "github_project": "notion-exporter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "notion-exporter"
}
        
Elapsed time: 0.15200s