Mastodon bot: Difference between revisions
(Created page with "This script uploads the results of our scripts to Mastodon through a bot account. Mastodon bot: https://dev.to/ayushsharma/tweet-toot-building-a-bot-for-mastodon-using-pytho...") |
Andre Castro (talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
A way to publish some text or images to a [https://joinmastodon.org/ Mastodon] (a decentralized, open source social network) using a bot account. | |||
* Mastodon instance dedicated to bots: https://botsin.space/about | |||
Tutorials: | |||
* https://dev.to/ayushsharma/tweet-toot-building-a-bot-for-mastodon-using-python-5a6d | |||
* https://shkspr.mobi/blog/2018/08/easy-guide-to-building-mastodon-bots/ | |||
==First things first:== | |||
* create a mastodon bot account | |||
* | |||
Line 15: | Line 22: | ||
Install Mastodon.py with pip | Install Mastodon.py with pip | ||
pip3 install Mastodon.py | |||
Latest revision as of 18:13, 3 February 2019
A way to publish some text or images to a Mastodon (a decentralized, open source social network) using a bot account.
- Mastodon instance dedicated to bots: https://botsin.space/about
Tutorials:
- https://dev.to/ayushsharma/tweet-toot-building-a-bot-for-mastodon-using-python-5a6d
- https://shkspr.mobi/blog/2018/08/easy-guide-to-building-mastodon-bots/
First things first:
- create a mastodon bot account
Mastodon API
Create a bot account
in your mastodon instance (more details here: https://dev.to/ayushsharma/tweet-toot-building-a-bot-for-mastodon-using-python-5a6d) and in preferences tick bot account.
Getting credentials for the Mastodon
More detailed guide: https://gist.github.com/aparrish/661fca5ce7b4882a8c6823db12d42d26
Install Mastodon.py with pip
pip3 install Mastodon.py
Get back a 2-tuple that contains the client ID and the client secret
python3 >>> 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", ... "CLIENT_SECRETS", ... api_base_url="your-instance-url") >>> api.log_in("bot-email@example.com", "bot-password", scopes=["read", "write"])
Run the script
(include the text or images you want to post inside the same folder with the script)
python3 mastodon_api.py