Mastodon bot

From XPUB & Lens-Based wiki
Revision as of 11:57, 14 October 2018 by Angeliki (talk | contribs) (Angeliki moved page Mastodon-api to Mastodon bot)

This script uploads the results of scripts to Mastodon through a bot account.

Mastodon bot:

Mastodon API

Create a bot account

in your mastodon instance (more details here: and in preferences tick bot account.

Getting credentials for the Mastodon

More detailed guide:

Install with pip

pip install

Get back a 2-tuple that contains the client ID and the client secret

>>> from mastodon import Mastodon
>>> Mastodon.create_app('your-app-name', scopes=['read', 'write'], api_base_url="your-instance-url")

Getting the access token

>>> api = Mastodon("CLIENT_ID",
...   api_base_url="your-instance-url")
>>> api.log_in("", "bot-password", scopes=["read", "write"])

Run the script (include the text or images you want to post inside the same folder with the script)