Last active
April 10, 2018 14:28
-
-
Save hasitanai/ae99f0024858f78f9d8f77c9c16e0bf2 to your computer and use it in GitHub Desktop.
ご注文はMastodonBotですか? 今すぐ動かしてみたい初めての方に☕ ref: https://qiita.com/Chino_Kafuu/items/6be7aa6798c7d7dcc129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mastodon import Mastodon | |
cocoa = Mastodon( | |
client_id = 'client.secret', #app情報 | |
access_token = 'user.secret', #ログイントークン | |
api_base_url = 'https://knzk.me' #インスタンス名 | |
) | |
cocoa.toot('チノちゃん!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mastodon import Mastodon | |
# Register app - 一回だけで問題ないです。 | |
url = 'https://knzk.me' #インスタンス先です | |
Mastodon.create_app( | |
u'ラビットハウス', #クライアント名 | |
api_base_url = url, | |
to_file = 'client.secret' #appを保存するファイル名になります | |
) | |
# Log in - アクセストークンを取得します。 | |
mastodon = Mastodon( | |
client_id = 'client.secret', | |
api_base_url = url | |
) | |
mastodon.log_in( | |
'my_login_email@knzk.me', #メールアドレス | |
'password', #パスワード | |
to_file = 'user.secret' #こちらがアクセストークンです | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment