Created
February 19, 2018 22:27
-
-
Save Lana-chan/b0d937968d22eca6dcd79a0524449f1d to your computer and use it in GitHub Desktop.
interactive script for generating persistent clientcred and usercred files for mastodon.py
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
#!/usr/bin/python3 | |
# interactive script for generating persistent | |
# clientcred and usercred files for mastodon.py | |
from mastodon import Mastodon | |
from getpass import getpass | |
import sys | |
if __name__ == "__main__": | |
app = input('app name (shows in web): ') | |
url = input('instance url: ') | |
email = input('account email: ') | |
password = getpass('account password: ') | |
password2 = getpass('repeat password: ') | |
if password2 != password: | |
sys.exit('passwords did not match') | |
Mastodon.create_app( | |
app, | |
api_base_url = url, | |
to_file = 'clientcred.secret' | |
) | |
mastodon = Mastodon( | |
client_id = 'clientcred.secret', | |
api_base_url = url | |
) | |
mastodon.log_in( | |
email, | |
password, | |
to_file = 'usercred.secret' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment