from mastodon import Mastodon import os if __name__ == "__main__": username = input("username: ") name = input("application name: ") url = input("server url: ") if os.path.exists("accounts") and not os.path.isdir("accounts"): print("accounts exists but isn't a directory") exit(2) elif not os.path.exists("accounts"): os.mkdir("accounts") Mastodon.create_app(name, scopes=["read:accounts", "write:statuses"], to_file=f"accounts/{username}.client.secret", api_base_url=url, user_agent="fedifeeds") masto = Mastodon(f"accounts/{username}.client.secret") print(masto.auth_request_url(scopes=["read:accounts", "write:statuses"])) masto.log_in(username, code=input("code: "), scopes=["read:accounts", "write:statuses"], to_file=f"accounts/{username}.secret")