wallabag

class platypush.plugins.wallabag.WallabagPlugin(client_id: str, client_secret: str, server_url: str = 'https://wallabag.it', username: Optional[str] = None, password: Optional[str] = None, credentials_file: str = '/home/blacklight/.local/share/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: Optional[str] = None, password: Optional[str] = None, credentials_file: str = '/home/blacklight/.local/share/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. Only needed for the first login, you can remove it afterwards. Alternatively, you can provide it on the login() method.

  • password – Wallabag password. Only needed for the first login, you can remove it afterwards. Alternatively, you can provide it on the login() method.

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

delete(id: int) Optional[dict][source]

Delete an entry by ID.

Parameters:

id – Entry ID.

Returns:

{
  "annotations": [
    {
      "comment": "My comment on this memorable quote",
      "created_at": "2022-11-21T08:50:45.429292+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2022-11-21T08:50:45.429320+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2022-11-21T08:50:45.429625+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": "2022-11-21T08:50:45.429659+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2022-11-21T08:50:45.429649+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2022-11-21T08:50:45.429639+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) Optional[dict][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": "2022-11-21T08:50:45.429292+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2022-11-21T08:50:45.429320+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2022-11-21T08:50:45.429625+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": true,
  "is_starred": true,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2022-11-21T08:50:45.429659+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2022-11-21T08:50:45.429649+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2022-11-21T08:50:45.429639+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: Optional[Iterable[str]] = None, since: Optional[int] = 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": "2022-11-21T08:50:45.429292+00:00",
        "id": 2345,
        "ranges": [
          [
            100,
            180
          ]
        ],
        "text": "Some memorable quote",
        "updated_at": "2022-11-21T08:50:45.429320+00:00"
      }
    ],
    "content": "Parsed content",
    "created_at": "2022-11-21T08:50:45.429625+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": "2022-11-21T08:50:45.429659+00:00",
    "published_by": [
      "Author 1",
      "Author 2"
    ],
    "reading_time": 10,
    "starred_at": "2022-11-21T08:50:45.429649+00:00",
    "tags": [
      "tech",
      "programming"
    ],
    "title": "Title of the saved page",
    "updated_at": "2022-11-21T08:50:45.429639+00:00",
    "url": "https://example.com/article/some-title"
  }
]

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

Create a new user session if not logged in.

Parameters:
  • username – Default username override.

  • password – Default password override.

save(url: str, title: Optional[str] = None, content: Optional[str] = None, tags: Optional[Iterable[str]] = None, authors: Optional[Iterable[str]] = None, archived: bool = False, starred: bool = False, public: bool = False, language: Optional[str] = None, preview_picture: Optional[str] = None) Optional[dict][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": "2022-11-21T08:50:45.429292+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2022-11-21T08:50:45.429320+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2022-11-21T08:50:45.429625+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": false,
  "is_starred": false,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2022-11-21T08:50:45.429659+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2022-11-21T08:50:45.429649+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2022-11-21T08:50:45.429639+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": "2022-11-21T08:50:45.429292+00:00",
        "id": 2345,
        "ranges": [
          [
            100,
            180
          ]
        ],
        "text": "Some memorable quote",
        "updated_at": "2022-11-21T08:50:45.429320+00:00"
      }
    ],
    "content": "Parsed content",
    "created_at": "2022-11-21T08:50:45.429625+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": "2022-11-21T08:50:45.429659+00:00",
    "published_by": [
      "Author 1",
      "Author 2"
    ],
    "reading_time": 10,
    "starred_at": "2022-11-21T08:50:45.429649+00:00",
    "tags": [
      "tech",
      "programming"
    ],
    "title": "Title of the saved page",
    "updated_at": "2022-11-21T08:50:45.429639+00:00",
    "url": "https://example.com/article/some-title"
  }
]

update(id: int, title: Optional[str] = None, content: Optional[str] = None, tags: Optional[Iterable[str]] = None, authors: Optional[Iterable[str]] = None, archived: bool = False, starred: bool = False, public: bool = False, language: Optional[str] = None, preview_picture: Optional[str] = None) Optional[dict][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": "2022-11-21T08:50:45.429292+00:00",
      "id": 2345,
      "ranges": [
        [
          100,
          180
        ]
      ],
      "text": "Some memorable quote",
      "updated_at": "2022-11-21T08:50:45.429320+00:00"
    }
  ],
  "content": "Parsed content",
  "created_at": "2022-11-21T08:50:45.429625+00:00",
  "id": 1234,
  "is_archived": true,
  "is_public": false,
  "is_starred": false,
  "language": "en",
  "mimetype": "text/html",
  "preview_picture": "https://example.com/article/some-title.jpg",
  "published_at": "2022-11-21T08:50:45.429659+00:00",
  "published_by": [
    "Author 1",
    "Author 2"
  ],
  "reading_time": 10,
  "starred_at": "2022-11-21T08:50:45.429649+00:00",
  "tags": [
    "tech",
    "programming"
  ],
  "title": "Title of the saved page",
  "updated_at": "2022-11-21T08:50:45.429639+00:00",
  "url": "https://example.com/article/some-title"
}