From: mpaglia0 Date: Sat, 19 Nov 2022 08:48:57 +0000 (+0100) Subject: Starting from ZERO X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=47581a0801cf9c5dcf26c9317248652c22d4083a;p=blog.git Starting from ZERO --- diff --git a/pelican_toot.py b/pelican_toot.py index a1bcb1fa..ee59fb73 100644 --- a/pelican_toot.py +++ b/pelican_toot.py @@ -2,43 +2,3 @@ """ Post new articles on Mastodon """ - -import string - -import logging -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 !')