From ae99c2d7237021e2abb20d4b41a24e0b73028519 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Wed, 22 Feb 2023 14:01:16 -0800 Subject: bot: support Mastodon OAuth2 login test callback test mastodon callback test callback clean customwebhook example bot: test oauth login test callback url test callback --- toot.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'toot.py') diff --git a/toot.py b/toot.py index e1995fd..659d232 100644 --- a/toot.py +++ b/toot.py @@ -1,12 +1,20 @@ from mastodon import Mastodon -from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID +from config import TOOT_API_BASE_URL, TOOT_CLIENT_SECRET, TOOT_ACCESS_TOKEN, TOOT_CLIENT_ID, MASTODON_CLIENT_ID_FILE ''' https://mastodonpy.readthedocs.io/en/stable/index.html ''' -mastodon_client = Mastodon(client_id=TOOT_CLIENT_ID, - client_secret=TOOT_CLIENT_SECRET, - api_base_url=TOOT_API_BASE_URL, - access_token=TOOT_ACCESS_TOKEN) +mastodon_client = Mastodon(client_id=MASTODON_CLIENT_ID_FILE, + api_base_url=TOOT_API_BASE_URL) + +url = mastodon_client.auth_request_url(redirect_uris="https://zjw.social/checkinbot/fedi_login_callback", scopes=['write:media', 'write:statuses']) +print(url) + +# mastodon_client.log_in( +# username="checkinbottest@jinwei.me", +# code='2RnDpj9lMGLWuIeppl-Cghy-iwSXzlJFWU6mQaKYD9o', +# # redirect_uri="urn:ietf:wg:oauth:2.0:oob", +# scopes=['write:media', 'write:statuses'] +# ) -- cgit v1.2.3