wallabag#

Description#

Plugin to interact with Wallabag (https://wallabag.it), an open-source alternative to Instapaper and Pocket.

Configuration#

wallabag:
  # [Required]
  # Client ID for your application - you can create one
  # at ``<server_url>/developer``.
  client_id:   # type=str

  # [Required]
  # Client secret for your application - you can
  # create one at ``<server_url>/developer``.
  client_secret:   # type=str

  # [Optional]
  # Base URL of the Wallabag server (default: ``https://wallabag.it``).
  # server_url: https://wallabag.it  # type=str

  # [Optional]
  # Wallabag username. This configuration attribute is
  # required for the first login. You can delete afterwards. However,
  # note that, without username and password, the session is valid only
  # as long as the ``refresh_token`` returned by the API is valid
  # (that's usually a couple of months by default). When the
  # ``refresh_token`` expires, you will have to either add again this
  # attribute to the configuration and restart the app (so the service
  # can create a new session), or manually provide your credentials
  # through the `WallabagPlugin.login <https://docs.platypush.tech/platypush/plugins/wallabag.html#platypush.plugins.wallabag.WallabagPlugin.login>`_ action.
  # username:   # type=Optional[str]

  # [Optional]
  # Wallabag password. This configuration attribute is
  # required for the first login. You can delete afterwards. However,
  # note that, without username and password, the session is valid only
  # as long as the ``refresh_token`` returned by the API is valid
  # (that's usually a couple of months by default). When the
  # ``refresh_token`` expires, you will have to either add again this
  # attribute to the configuration and restart the app (so the service
  # can create a new session), or manually provide your credentials
  # through the `WallabagPlugin.login <https://docs.platypush.tech/platypush/plugins/wallabag.html#platypush.plugins.wallabag.WallabagPlugin.login>`_ action.
  # password:   # type=Optional[str]

  # [Optional]
  # Path to the file where the OAuth session
  # parameters will be stored (default:
  # ``<WORKDIR>/wallabag/credentials.json``).
  # credentials_file: /var/lib/platypush/wallabag/credentials.json  # type=str

Actions#

Module reference#

class platypush.plugins.wallabag.WallabagPlugin(client_id: str, client_secret: str, server_url: str = 'https://wallabag.it', username: str | None = None, password: str | None = None, credentials_file: str = '/var/lib/platypush/wallabag/credentials.json', **kwargs)[source]#

Bases: Plugin

Plugin to interact with Wallabag (https://wallabag.it), an open-source alternative to Instapaper and Pocket.

__init__(client_id: str, client_secret: str, server_url: str = 'https://wallabag.it', username: str | None = None, password: str | None = None, credentials_file: str = '/var/lib/platypush/wallabag/credentials.json', **kwargs)[source]#
Parameters:
  • client_id – Client ID for your application - you can create one at <server_url>/developer.

  • client_secret – Client secret for your application - you can create one at <server_url>/developer.

  • server_url – Base URL of the Wallabag server (default: https://wallabag.it).

  • username – Wallabag username. This configuration attribute is required for the first login. You can delete afterwards. However, note that, without username and password, the session is valid only as long as the refresh_token returned by the API is valid (that’s usually a couple of months by default). When the refresh_token expires, you will have to either add again this attribute to the configuration and restart the app (so the service can create a new session), or manually provide your credentials through the login() action.

  • password – Wallabag password. This configuration attribute is required for the first login. You can delete afterwards. However, note that, without username and password, the session is valid only as long as the refresh_token returned by the API is valid (that’s usually a couple of months by default). When the refresh_token expires, you will have to either add again this attribute to the configuration and restart the app (so the service can create a new session), or manually provide your credentials through the login() action.

  • credentials_file – Path to the file where the OAuth session parameters will be stored (default: <WORKDIR>/wallabag/credentials.json).

delete(id: int) dict | None[source]#

Delete an entry by ID.

Parameters:

id – Entry ID.

Returns:

{
  "annotations": [
    {
      "comment": "My comment on this memorable quote",
      "created_at": "2024-07-16T18:25:41.582859+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2024-07-16T18:25:41.582878+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2024-07-16T18:25:41.583192+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": false,
  "is_starred": true,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2024-07-16T18:25:41.583224+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2024-07-16T18:25:41.583215+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2024-07-16T18:25:41.583205+00:00",
  "url": "https://example.com/article/some-title"
}

export(id: int, file: str, format: str = 'txt')[source]#

Export a saved entry to a file in the specified format.

Parameters:
  • id – Entry ID.

  • file – Output filename.

  • format – Output format. Supported: txt, xml, csv, pdf, epub and mobi (default: txt).

get(id: int) dict | None[source]#

Get the content and metadata of a link by ID.

Parameters:

id – Entry ID.

Returns:

{
  "annotations": [
    {
      "comment": "My comment on this memorable quote",
      "created_at": "2024-07-16T18:25:41.582859+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2024-07-16T18:25:41.582878+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2024-07-16T18:25:41.583192+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": true,
  "is_starred": false,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2024-07-16T18:25:41.583224+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2024-07-16T18:25:41.583215+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2024-07-16T18:25:41.583205+00:00",
  "url": "https://example.com/article/some-title"
}

list(archived: bool = True, starred: bool = False, sort: str = 'created', descending: bool = False, page: int = 1, limit: int = 30, tags: Iterable[str] | None = None, since: int | None = None, full: bool = True) List[dict][source]#

List saved links.

Parameters:
  • archived – Include archived items (default: True).

  • starred – Include only starred items (default: False).

  • sort – Timestamp sort criteria. Supported: created, updated, archived (default: created).

  • descending – Sort in descending order (default: False).

  • page – Results page to be retrieved (default: 1).

  • limit – Maximum number of entries per page (default: 30).

  • tags – Filter by a list of tags.

  • since – Return entries created after this timestamp (as a UNIX timestamp).

  • full – Include the full parsed body of the saved entry.

Returns:

[
  {
    "annotations": [
      {
        "comment": "My comment on this memorable quote",
        "created_at": "2024-07-16T18:25:41.582859+00:00",
        "id": 2345,
        "ranges": [
          [
            100,
            180
          ]
        ],
        "text": "Some memorable quote",
        "updated_at": "2024-07-16T18:25:41.582878+00:00"
      }
    ],
    "content": "Parsed content",
    "created_at": "2024-07-16T18:25:41.583192+00:00",
    "id": 1234,
    "is_archived": false,
    "is_public": true,
    "is_starred": true,
    "language": "en",
    "mimetype": "text/html",
    "preview_picture": "https://example.com/article/some-title.jpg",
    "published_at": "2024-07-16T18:25:41.583224+00:00",
    "published_by": [
      "Author 1",
      "Author 2"
    ],
    "reading_time": 10,
    "starred_at": "2024-07-16T18:25:41.583215+00:00",
    "tags": [
      "tech",
      "programming"
    ],
    "title": "Title of the saved page",
    "updated_at": "2024-07-16T18:25:41.583205+00:00",
    "url": "https://example.com/article/some-title"
  }
]

login(username: str | None = None, password: str | None = None)[source]#

Create a new user session if not logged in.

Parameters:
  • username – Default username override.

  • password – Default password override.

save(url: str, title: str | None = None, content: str | None = None, tags: Iterable[str] | None = None, authors: Iterable[str] | None = None, archived: bool = False, starred: bool = False, public: bool = False, language: str | None = None, preview_picture: str | None = None) dict | None[source]#

Save a link to Wallabag.

Parameters:
  • url – URL to be saved.

  • title – Entry title (default: parsed from the page content).

  • content – Entry content (default: parsed from the entry itself).

  • tags – List of tags to attach to the entry.

  • authors – List of authors of the entry (default: parsed from the page content).

  • archived – Whether the entry should be created in the archive (default: False).

  • starred – Whether the entry should be starred (default: False).

  • public – Whether the entry should be publicly available. If so, a public URL will be generated (default: False).

  • language – Language of the entry.

  • preview_picture – URL of a picture to be used for the preview (default: parsed from the page itself).

Returns:

{
  "annotations": [
    {
      "comment": "My comment on this memorable quote",
      "created_at": "2024-07-16T18:25:41.582859+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2024-07-16T18:25:41.582878+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2024-07-16T18:25:41.583192+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": true,
  "is_starred": false,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2024-07-16T18:25:41.583224+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2024-07-16T18:25:41.583215+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2024-07-16T18:25:41.583205+00:00",
  "url": "https://example.com/article/some-title"
}

search(term: str, page: int = 1, limit: int = 30) List[dict][source]#

Search links by some text.

Parameters:
  • term – Term to be searched.

  • page – Results page to be retrieved (default: 1).

  • limit – Maximum number of entries per page (default: 30).

Returns:

[
  {
    "annotations": [
      {
        "comment": "My comment on this memorable quote",
        "created_at": "2024-07-16T18:25:41.582859+00:00",
        "id": 2345,
        "ranges": [
          [
            100,
            180
          ]
        ],
        "text": "Some memorable quote",
        "updated_at": "2024-07-16T18:25:41.582878+00:00"
      }
    ],
    "content": "Parsed content",
    "created_at": "2024-07-16T18:25:41.583192+00:00",
    "id": 1234,
    "is_archived": false,
    "is_public": true,
    "is_starred": false,
    "language": "en",
    "mimetype": "text/html",
    "preview_picture": "https://example.com/article/some-title.jpg",
    "published_at": "2024-07-16T18:25:41.583224+00:00",
    "published_by": [
      "Author 1",
      "Author 2"
    ],
    "reading_time": 10,
    "starred_at": "2024-07-16T18:25:41.583215+00:00",
    "tags": [
      "tech",
      "programming"
    ],
    "title": "Title of the saved page",
    "updated_at": "2024-07-16T18:25:41.583205+00:00",
    "url": "https://example.com/article/some-title"
  }
]

update(id: int, title: str | None = None, content: str | None = None, tags: Iterable[str] | None = None, authors: Iterable[str] | None = None, archived: bool = False, starred: bool = False, public: bool = False, language: str | None = None, preview_picture: str | None = None) dict | None[source]#

Update a link entry saved to Wallabag.

Parameters:
  • id – Entry ID.

  • title – New entry title.

  • content – New entry content.

  • tags – List of tags to attach to the entry.

  • authors – List of authors of the entry.

  • archived – Archive/unarchive the entry.

  • starred – Star/unstar the entry.

  • public – Mark the entry as public/private.

  • language – Change the language of the entry.

  • preview_picture – Change the preview picture URL.

Returns:

{
  "annotations": [
    {
      "comment": "My comment on this memorable quote",
      "created_at": "2024-07-16T18:25:41.582859+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2024-07-16T18:25:41.582878+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2024-07-16T18:25:41.583192+00:00",
  "id": 1234,
  "is_archived": false,
  "is_public": false,
  "is_starred": true,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2024-07-16T18:25:41.583224+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2024-07-16T18:25:41.583215+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2024-07-16T18:25:41.583205+00:00",
  "url": "https://example.com/article/some-title"
}