readwise-reader-cli


Namereadwise-reader-cli JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryEngage with your Readwise Reader library through your command-line.
upload_time2023-09-25 20:14:35
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords api readwise cli python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Reader API Command-Line Interface

![](./images/reader-terminal.png)

This repository provides a command-line interface (CLI) for interacting with [Readwise's Reader API](https://readwise.io/reader_api). This tool allows you to interact with the API directly from your command line, making it easy to `add` and `list` documents from your Reader library.

Also, you can `upload` documents from your browser reading list, such as Chrome ReadingList.

Please note that future updates will include support for additional browsers.

## Installation

Set up a virtual environment and then run:

```bash
pip install readwise-reader-cli
```

## Usage

Before using the CLI, make sure to set the READER_API_TOKEN environment variable. You can obtain your API token [here](https://readwise.io/access_token).

```bash
export READER_API_TOKEN={your_api_token}
```

The CLI provides the following commands:

```bash
Usage: python -m readercli [OPTIONS] COMMAND [ARGS]...

  Interact with your Reader Library

Options:
  --help  Show this message and exit.

Commands:
  add       Add Document
  lib       Library breakdown
  list      List Documents
  upload    Upload Reading List File
  validate  Validate token
```

### List Documents

```bash
Usage: python -m readercli list [OPTIONS]

  List Documents

Options:
  -l, --location [new|archive|later|feed]
                                  Document(s) location
  -c, --category [article|tweet|pdf|epub|email|note|video|highlight|rss]
                                  Document(s) category
  -a, --update-after [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
                                  Updated after date in ISO format. Default:
                                  last 24hrs.
  -d, --date-range TEXT           View documents updated after choosen time:
                                  today, week, month.
  -L, --layout [table|list]       Display documents either as a list or table.
                                  Default: table.
  -n, --num-results INTEGER       The number of documents to show.
  -P, --pager                     Use to page output.
  --help                          Show this message and exit.
```

Examples:

```bash
python -m readercli list --location archive
```

```bash
python -m readercli list --location archive --category article
```

```bash
python -m readercli list --location archive --category article --update-after 2023-01-01
```

```bash
python -m readercli list --location archive --category article --update-after 2023-01-01 --layout list
```

```bash
python -m readercli list --location archive --category article --date-range week
```

### Layouts

![table](./images/table.png)

![list_table](./images/list.png)

### Upload a Reading List (Google Chrome support only)

**THINGS TO NOTE:**

- **RATE LIMIT - Due to Reader's API rate limit of 20 requests per minute, a larger list will take a few minutes to upload.**

- **LACK OF READING LIST APIs - There is no API to pull your ReadingList from Google, but it is being looked at [here](https://bugs.chromium.org/p/chromium/issues/detail?id=1238372).**

To `upload` your Chrome Reading List, you first need to download your data from your account, then follow these steps:

1. Navigate to the [Data & Privacy](https://myaccount.google.com/data-and-privacy) section.
2. Find the "Download your data" option and click on it.
3. A list of data to export will appear. Click "Deselect all" and then locate the Chrome section.
4. Click "All Chrome data Included" and select ONLY "ReadingList".
5. Save the downloaded `.html` file to your preferred directory and take note of the file path.
6. Run the `import` command.

```bash
Usage: python -m readercli upload [OPTIONS] INPUT_FILE

  Upload Reading List File

Options:
  --file-type [html|csv]
  --help                  Show this message and exit.
```

Examples:

```bash
python -m readercli upload /path/to/ReadingList.html
```

```bash
python -m readercli upload --file-type csv /path/to/ReadingList.csv
```

### Add Document

```bash
Usage: python -m readercli add [OPTIONS] URL

  Add Document

Options:
  --help  Show this message and exit.
```

Example:

```bash
python -m readercli add http://www.example.com
```

### Library Overview

```bash
Usage: python -m readercli lib [OPTIONS]

  Library breakdown

Options:
  -V, --view [category|location|tags]
  --help                          Show this message and exit.
```

```bash
python -m readercli lib

  Category Breakdown
┏━━━━━━━━━━━━━┳━━━━━━━┓
┃ Name        ┃ Count ┃
┡━━━━━━━━━━━━━╇━━━━━━━┩
│ 🖍️ highlight│   724 │
│ 📡️ rss      │   391 │
│ ✉️ email     │   363 │
│ 📰️ article  │   264 │
│ 📝️ note     │   140 │
│ 📄️ pdf      │    83 │
│ 🐦️ tweet    │    25 │
│ 📹️ video    │    10 │
│ 📖️ epub     │     0 │
└─────────────┴───────┘

python -m readercli lib --view [location | tags]

 Location Breakdown
┏━━━━━━━━━━━┳━━━━━━━┓
┃ Name      ┃ Count ┃
┡━━━━━━━━━━━╇━━━━━━━┩
│ 🗄️ archive│  1124 │
│ 🕑️ later  │   241 │
│ ⭐️ new    │    10 │
│ 📥️ feed   │     2 │
└───────────┴───────┘

python -m readercli lib --view tags

Tags Breakdown
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓
┃ Name                   ┃ Count ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩
│ python                 │    32 │
│ documentation          │     9 │
│ programming            │     7 │
│ github                 │     7 │
│ git                    │     6 │
│ packages               │     6 │
│ design-patterns        │     6 │
│ mac                    │     1 │
└────────────────────────┴───────┘
```

### Validate Token

```bash
Usage: python -m readercli validate [OPTIONS] TOKEN

  Validate token

Options:
  --help  Show this message and exit.
```

## Main Third-Party Libraries

- [click](https://github.com/pallets/click)
- [pydantic](https://github.com/pydantic/pydantic)
- [requests](https://github.com/psf/requests)
- [rich](https://github.com/Textualize/rich)

## Inspiration

- [starcli](https://github.com/hedyhli/starcli)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "readwise-reader-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "api,readwise,cli,python",
    "author": "",
    "author_email": "Scott Carvalho <scottcarvalho71@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8f/33/8e3c08e54f4fb1493117f0b6f5fd19f2d2f8d9524d962355069ee769b0b9/readwise_reader_cli-1.0.0.tar.gz",
    "platform": null,
    "description": "# Reader API Command-Line Interface\n\n![](./images/reader-terminal.png)\n\nThis repository provides a command-line interface (CLI) for interacting with [Readwise's Reader API](https://readwise.io/reader_api). This tool allows you to interact with the API directly from your command line, making it easy to `add` and `list` documents from your Reader library.\n\nAlso, you can `upload` documents from your browser reading list, such as Chrome ReadingList.\n\nPlease note that future updates will include support for additional browsers.\n\n## Installation\n\nSet up a virtual environment and then run:\n\n```bash\npip install readwise-reader-cli\n```\n\n## Usage\n\nBefore using the CLI, make sure to set the READER_API_TOKEN environment variable. You can obtain your API token [here](https://readwise.io/access_token).\n\n```bash\nexport READER_API_TOKEN={your_api_token}\n```\n\nThe CLI provides the following commands:\n\n```bash\nUsage: python -m readercli [OPTIONS] COMMAND [ARGS]...\n\n  Interact with your Reader Library\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  add       Add Document\n  lib       Library breakdown\n  list      List Documents\n  upload    Upload Reading List File\n  validate  Validate token\n```\n\n### List Documents\n\n```bash\nUsage: python -m readercli list [OPTIONS]\n\n  List Documents\n\nOptions:\n  -l, --location [new|archive|later|feed]\n                                  Document(s) location\n  -c, --category [article|tweet|pdf|epub|email|note|video|highlight|rss]\n                                  Document(s) category\n  -a, --update-after [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]\n                                  Updated after date in ISO format. Default:\n                                  last 24hrs.\n  -d, --date-range TEXT           View documents updated after choosen time:\n                                  today, week, month.\n  -L, --layout [table|list]       Display documents either as a list or table.\n                                  Default: table.\n  -n, --num-results INTEGER       The number of documents to show.\n  -P, --pager                     Use to page output.\n  --help                          Show this message and exit.\n```\n\nExamples:\n\n```bash\npython -m readercli list --location archive\n```\n\n```bash\npython -m readercli list --location archive --category article\n```\n\n```bash\npython -m readercli list --location archive --category article --update-after 2023-01-01\n```\n\n```bash\npython -m readercli list --location archive --category article --update-after 2023-01-01 --layout list\n```\n\n```bash\npython -m readercli list --location archive --category article --date-range week\n```\n\n### Layouts\n\n![table](./images/table.png)\n\n![list_table](./images/list.png)\n\n### Upload a Reading List (Google Chrome support only)\n\n**THINGS TO NOTE:**\n\n- **RATE LIMIT - Due to Reader's API rate limit of 20 requests per minute, a larger list will take a few minutes to upload.**\n\n- **LACK OF READING LIST APIs - There is no API to pull your ReadingList from Google, but it is being looked at [here](https://bugs.chromium.org/p/chromium/issues/detail?id=1238372).**\n\nTo `upload` your Chrome Reading List, you first need to download your data from your account, then follow these steps:\n\n1. Navigate to the [Data & Privacy](https://myaccount.google.com/data-and-privacy) section.\n2. Find the \"Download your data\" option and click on it.\n3. A list of data to export will appear. Click \"Deselect all\" and then locate the Chrome section.\n4. Click \"All Chrome data Included\" and select ONLY \"ReadingList\".\n5. Save the downloaded `.html` file to your preferred directory and take note of the file path.\n6. Run the `import` command.\n\n```bash\nUsage: python -m readercli upload [OPTIONS] INPUT_FILE\n\n  Upload Reading List File\n\nOptions:\n  --file-type [html|csv]\n  --help                  Show this message and exit.\n```\n\nExamples:\n\n```bash\npython -m readercli upload /path/to/ReadingList.html\n```\n\n```bash\npython -m readercli upload --file-type csv /path/to/ReadingList.csv\n```\n\n### Add Document\n\n```bash\nUsage: python -m readercli add [OPTIONS] URL\n\n  Add Document\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\npython -m readercli add http://www.example.com\n```\n\n### Library Overview\n\n```bash\nUsage: python -m readercli lib [OPTIONS]\n\n  Library breakdown\n\nOptions:\n  -V, --view [category|location|tags]\n  --help                          Show this message and exit.\n```\n\n```bash\npython -m readercli lib\n\n  Category Breakdown\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Name        \u2503 Count \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 \ud83d\udd8d\ufe0f highlight\u2502   724 \u2502\n\u2502 \ud83d\udce1\ufe0f rss      \u2502   391 \u2502\n\u2502 \u2709\ufe0f email     \u2502   363 \u2502\n\u2502 \ud83d\udcf0\ufe0f article  \u2502   264 \u2502\n\u2502 \ud83d\udcdd\ufe0f note     \u2502   140 \u2502\n\u2502 \ud83d\udcc4\ufe0f pdf      \u2502    83 \u2502\n\u2502 \ud83d\udc26\ufe0f tweet    \u2502    25 \u2502\n\u2502 \ud83d\udcf9\ufe0f video    \u2502    10 \u2502\n\u2502 \ud83d\udcd6\ufe0f epub     \u2502     0 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\npython -m readercli lib --view [location | tags]\n\n Location Breakdown\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Name      \u2503 Count \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 \ud83d\uddc4\ufe0f archive\u2502  1124 \u2502\n\u2502 \ud83d\udd51\ufe0f later  \u2502   241 \u2502\n\u2502 \u2b50\ufe0f new    \u2502    10 \u2502\n\u2502 \ud83d\udce5\ufe0f feed   \u2502     2 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\npython -m readercli lib --view tags\n\nTags Breakdown\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Name                   \u2503 Count \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 python                 \u2502    32 \u2502\n\u2502 documentation          \u2502     9 \u2502\n\u2502 programming            \u2502     7 \u2502\n\u2502 github                 \u2502     7 \u2502\n\u2502 git                    \u2502     6 \u2502\n\u2502 packages               \u2502     6 \u2502\n\u2502 design-patterns        \u2502     6 \u2502\n\u2502 mac                    \u2502     1 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n### Validate Token\n\n```bash\nUsage: python -m readercli validate [OPTIONS] TOKEN\n\n  Validate token\n\nOptions:\n  --help  Show this message and exit.\n```\n\n## Main Third-Party Libraries\n\n- [click](https://github.com/pallets/click)\n- [pydantic](https://github.com/pydantic/pydantic)\n- [requests](https://github.com/psf/requests)\n- [rich](https://github.com/Textualize/rich)\n\n## Inspiration\n\n- [starcli](https://github.com/hedyhli/starcli)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Engage with your Readwise Reader library through your command-line.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Scarvy/readwise-reader-cli"
    },
    "split_keywords": [
        "api",
        "readwise",
        "cli",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e27e8f16b7075cfc45b8c27240b24e551cc46a32690bcf5cbe02704925de2120",
                "md5": "e4cbafdf45da715b4cc7c2572ed5df37",
                "sha256": "81fbfe430f9116d9dc1456fec1d0cbd43ee3aa742615d03f9e7c6c28a0aadcb8"
            },
            "downloads": -1,
            "filename": "readwise_reader_cli-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4cbafdf45da715b4cc7c2572ed5df37",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17233,
            "upload_time": "2023-09-25T20:14:33",
            "upload_time_iso_8601": "2023-09-25T20:14:33.463658Z",
            "url": "https://files.pythonhosted.org/packages/e2/7e/8f16b7075cfc45b8c27240b24e551cc46a32690bcf5cbe02704925de2120/readwise_reader_cli-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f338e3c08e54f4fb1493117f0b6f5fd19f2d2f8d9524d962355069ee769b0b9",
                "md5": "afefda9a091b12e0cb18dd20f0078fbd",
                "sha256": "141daa1c49202b30b993f0a0a9b4df1b2210405d745e18ee2cf13021d9c82f95"
            },
            "downloads": -1,
            "filename": "readwise_reader_cli-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "afefda9a091b12e0cb18dd20f0078fbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15608,
            "upload_time": "2023-09-25T20:14:35",
            "upload_time_iso_8601": "2023-09-25T20:14:35.407063Z",
            "url": "https://files.pythonhosted.org/packages/8f/33/8e3c08e54f4fb1493117f0b6f5fd19f2d2f8d9524d962355069ee769b0b9/readwise_reader_cli-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-25 20:14:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Scarvy",
    "github_project": "readwise-reader-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "readwise-reader-cli"
}
        
Elapsed time: 0.22048s