from mastodon import Mastodon with open('token.txt','r') as token: mastodon = Mastodon(access_token=token.read(),api_base_url="https://post.lurk.org/") mycreds = mastodon.account_verify_credentials() #dictionary with my user info print(mycreds) myname = mycreds['display_name'] toot_text = '{} whishes you a good hello world'.format(myname) mastodon.toot(toot_text) print(toot_text)