from mastodon import Mastodon 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=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'] # )