From 66ed83de2d15a3bdc9624e2796cfbb5873e03bfe Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Wed, 16 Nov 2022 14:37:12 +0100 Subject: [PATCH] Update pelican_toot.py --- pelican_toot.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pelican_toot.py b/pelican_toot.py index c402be38..a1bcb1fa 100644 --- a/pelican_toot.py +++ b/pelican_toot.py @@ -11,4 +11,34 @@ logger = logging.getLogger(__name__) from pelican import signals # https://github.com/halcy/Mastodon.py + +# Copied from Mastodon.py readme - fix it!! +# Register your app! This only needs to be done once. Uncomment the code and substitute in your information. + +from mastodon import Mastodon + +''' +Mastodon.create_app( + 'pytooterapp', + api_base_url = 'https://mastodon.social', + to_file = 'pytooter_clientcred.secret' +) +''' + +# Then login. This can be done every time, or use persisted. + from mastodon import Mastodon + +mastodon = Mastodon(client_id = 'pytooter_clientcred.secret') +mastodon.log_in( + 'my_login_email@example.com', + 'incrediblygoodpassword', + to_file = 'pytooter_usercred.secret' +) + +# To post, create an actual API instance. + +from mastodon import Mastodon + +mastodon = Mastodon(access_token = 'pytooter_usercred.secret') +mastodon.toot('Tooting from Python using #mastodonpy !') -- 2.30.2