python-notion-exporter


Namepython-notion-exporter JSON
Version 1.0.6 PyPI version JSON
download
home_pagehttps://github.com/tomchen/example_pypi_package
SummaryExport and download Notion pages asynchronously
upload_time2023-09-18 12:26:27
maintainer
docs_urlNone
authorRoméo Phillips
requires_python>=3.6
license
keywords notion notion-api python_notion_exporter notion-downloader notion-py
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NotionExporter

## Description

`NotionExporter` is a Python class designed to simplify the process of exporting content from Notion. It provides an interface to configure, trigger, and download content exports from Notion. The class supports exporting content in various formats (Markdown, HTML, PDF) and also allows users to choose the scope of the export (current view vs. all content).

## Features

- Export content in **Markdown**, **HTML**, or **PDF** format.
- Configure the scope of your export: **current view** or **all content**.
- Option to include or exclude files in the export.
- Flatten the file tree structure upon export.
- Export multiple pages concurrently for faster processing.
- Monitor export progress with a progress bar.
- Automatically unpack zipped export files.

## Usage
1. **Download**:

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


2. **Initialization**:

   ```python
   from python_notion_exporter import NotionExporter
   
   if __name__ == "__main__":
       exporter = NotionExporter(
           token_v2="YOUR_NOTION_TOKEN",
           file_token="YOUR_FILE_TOKEN",
           pages={"Page Name": "Page ID"},
           export_directory="path/to/save",
           flatten_export_file_tree=True,
           export_type=ExportType.MARKDOWN,
           current_view_export_type=ViewExportType.CURRENT_VIEW,
           include_files=True,
           recursive=True
       )
       exporter.process()
   ```

   You will need to get the `token_v2` and `file_token` values from your Notion cookies. The `pages` dictionary should contain pairs of `page_name: page_id` for each page you want to export.

## Needed Cookies

To export anything from Notion, one needs to authenticate oneself with some
Cookies (like a browser would). These cookies are called `token_v2` and
`file_token`. They are set on all requests of a logged in user when using the
Notion web-app.


### How to retrieve the Cookies?

- Go to [notion.so](https://notion.so).
- Log in with your account.
- Open the developer tools of your browser, open Application > Storage > Cookies
  (Chrome); Storage tab (Firefox).
- Copy the value of the Cookies called `token_v2` and `file_token` and paste
  them somewhere safe.
- ⚠️ If you don't find `file_token`, you need to have at least had exported a file manually once.
- Those cookies have a **1 year validity**, so you don't need to do this often.

2. **Process Exports**:

   ```python
   exporter.process()
   ```

   This will initiate the export, download, and unpacking processes for the pages defined.

## Requirements

- Python 3.6+

For more details or any issues, please raise a ticket or contact the maintainers.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tomchen/example_pypi_package",
    "name": "python-notion-exporter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "notion,notion-api,python_notion_exporter,notion-downloader,notion-py",
    "author": "Rom\u00e9o Phillips",
    "author_email": "phillipsromeo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7f/37/7bbaeeaeb958f970bb3d2d2b95490547028b53465e086652cf88d00429cb/python_notion_exporter-1.0.6.tar.gz",
    "platform": null,
    "description": "# NotionExporter\n\n## Description\n\n`NotionExporter` is a Python class designed to simplify the process of exporting content from Notion. It provides an interface to configure, trigger, and download content exports from Notion. The class supports exporting content in various formats (Markdown, HTML, PDF) and also allows users to choose the scope of the export (current view vs. all content).\n\n## Features\n\n- Export content in **Markdown**, **HTML**, or **PDF** format.\n- Configure the scope of your export: **current view** or **all content**.\n- Option to include or exclude files in the export.\n- Flatten the file tree structure upon export.\n- Export multiple pages concurrently for faster processing.\n- Monitor export progress with a progress bar.\n- Automatically unpack zipped export files.\n\n## Usage\n1. **Download**:\n\n   ```bash\n   pip install python-notion-exporter\n   ```\n\n\n2. **Initialization**:\n\n   ```python\n   from python_notion_exporter import NotionExporter\n   \n   if __name__ == \"__main__\":\n       exporter = NotionExporter(\n           token_v2=\"YOUR_NOTION_TOKEN\",\n           file_token=\"YOUR_FILE_TOKEN\",\n           pages={\"Page Name\": \"Page ID\"},\n           export_directory=\"path/to/save\",\n           flatten_export_file_tree=True,\n           export_type=ExportType.MARKDOWN,\n           current_view_export_type=ViewExportType.CURRENT_VIEW,\n           include_files=True,\n           recursive=True\n       )\n       exporter.process()\n   ```\n\n   You will need to get the `token_v2` and `file_token` values from your Notion cookies. The `pages` dictionary should contain pairs of `page_name: page_id` for each page you want to export.\n\n## Needed Cookies\n\nTo export anything from Notion, one needs to authenticate oneself with some\nCookies (like a browser would). These cookies are called `token_v2` and\n`file_token`. They are set on all requests of a logged in user when using the\nNotion web-app.\n\n\n### How to retrieve the Cookies?\n\n- Go to [notion.so](https://notion.so).\n- Log in with your account.\n- Open the developer tools of your browser, open Application > Storage > Cookies\n  (Chrome); Storage tab (Firefox).\n- Copy the value of the Cookies called `token_v2` and `file_token` and paste\n  them somewhere safe.\n- \u26a0\ufe0f If you don't find `file_token`, you need to have at least had exported a file manually once.\n- Those cookies have a **1 year validity**, so you don't need to do this often.\n\n2. **Process Exports**:\n\n   ```python\n   exporter.process()\n   ```\n\n   This will initiate the export, download, and unpacking processes for the pages defined.\n\n## Requirements\n\n- Python 3.6+\n\nFor more details or any issues, please raise a ticket or contact the maintainers.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Export and download Notion pages asynchronously",
    "version": "1.0.6",
    "project_urls": {
        "Bug Reports": "https://github.com/Strvm/python-notion-exporter",
        "Documentation": "https://github.com/Strvm/python-notion-exporter",
        "Homepage": "https://github.com/tomchen/example_pypi_package",
        "Source Code": "https://github.com/Strvm/python-notion-exporter"
    },
    "split_keywords": [
        "notion",
        "notion-api",
        "python_notion_exporter",
        "notion-downloader",
        "notion-py"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5dd84a27731234db615139caab472dad7e0d65e68a9a92604d57bb7aa34f1a92",
                "md5": "b857ddfaf8561a544ff3e9fa279f65bf",
                "sha256": "c049acf1b8906fa2ef994821e945f35be3e4a9c856e5abfb06a126749378d7cc"
            },
            "downloads": -1,
            "filename": "python_notion_exporter-1.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b857ddfaf8561a544ff3e9fa279f65bf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6988,
            "upload_time": "2023-09-18T12:26:24",
            "upload_time_iso_8601": "2023-09-18T12:26:24.696924Z",
            "url": "https://files.pythonhosted.org/packages/5d/d8/4a27731234db615139caab472dad7e0d65e68a9a92604d57bb7aa34f1a92/python_notion_exporter-1.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f377bbaeeaeb958f970bb3d2d2b95490547028b53465e086652cf88d00429cb",
                "md5": "4efa8fb021580b657642f049da27403b",
                "sha256": "0a5d11f343569c963b4a4b2da0d1eb40adf7f9204c7f3956c6ad635f47b5a4ec"
            },
            "downloads": -1,
            "filename": "python_notion_exporter-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "4efa8fb021580b657642f049da27403b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7051,
            "upload_time": "2023-09-18T12:26:27",
            "upload_time_iso_8601": "2023-09-18T12:26:27.051545Z",
            "url": "https://files.pythonhosted.org/packages/7f/37/7bbaeeaeb958f970bb3d2d2b95490547028b53465e086652cf88d00429cb/python_notion_exporter-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-18 12:26:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tomchen",
    "github_project": "example_pypi_package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "python-notion-exporter"
}
        
Elapsed time: 0.54602s