Skip to content

Instantly share code, notes, and snippets.

@miya
Last active April 7, 2018 19:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miya/a7a3abaf3ab2a7c3725babcd6b338a18 to your computer and use it in GitHub Desktop.
Save miya/a7a3abaf3ab2a7c3725babcd6b338a18 to your computer and use it in GitHub Desktop.
MastodonのSetupするやつ
from mastodon import Mastodon
url = "https://mstdn.jp" #URLの部分はインスタンスURLです。今回はmstdn.jpになっていますが、任意で変更して下さい。
name = input('クライアント名\n> ') #クライアント名を入力して下さい。(自由記述)
#Mastodonのアプリ登録を行ないます。
Mastodon.create_app(name,
api_base_url = url,
to_file = "app_key.txt"
)
print('api_key作成完了!')
mail = input('メールアドレス\n> ') #アカウント作成に使用したメールアドレスを入力して下さい
passwd = input('パスワード\n> ') #アカウント作成に使用したパスワードを入力して下さい。
#生成されたapp.keyをしてしてログインします。
mastodon = Mastodon(
client_id="app_key.txt",
api_base_url = url)
mastodon.log_in(
mail,
passwd,
to_file = "user_key.txt")
print('user_key作成完了!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment