amoorion_mastodon.base

mastodon plugin: the REST API of a Mastodon (or compatible) server.

Secrets (mastodon/<key>): uri (the server, e.g. https://mastodon.social) and token (an access token of an application made in the account’s Preferences → Development, scopes read:accounts read:statuses write:statuses). The server’s own character limit is asked once and checked before sending; links count as 23 characters, as Mastodon counts them.

Classes

Mastodon(vault[, view])

Mastodon's REST API on the instance the vault names.

class amoorion_mastodon.base.Mastodon(vault, view=None)[source]

Bases: HttpPlugin

Mastodon’s REST API on the instance the vault names.

The length limit is the instance’s own, asked once.

Parameters:
post(post)[source]

Publish a post; answers the message as the platform stored it.

Parameters:

post (Post)

Return type:

Message

read(limit=20)[source]

The latest messages, newest first, at most limit.

Parameters:

limit (int)

Return type:

list[Message]

reply(to, text)[source]

Answer a message by its id; answers the new message.

Parameters:
Return type:

Message

delete(message)[source]

Delete a message by its id.

Parameters:

message (Message)

Return type:

None

profile()[source]

The name this account gets in the dataset.

Return type:

str