Small rephrasing and reformatting.

Avoid prompt lines > 72 chars.
This commit is contained in:
Bastien 2017-05-13 07:55:47 +02:00
parent 7b6d276606
commit e7d277e239

View file

@ -21,10 +21,10 @@ from mastodon import Mastodon
from mastodon.Mastodon import MastodonIllegalArgumentError from mastodon.Mastodon import MastodonIllegalArgumentError
import sys import sys
print('\nThis app generates Mastodon app credentials needed by Feed2toot.\nfeed2toot_clientcred.txt and feed2toot_usercred.txt will be written in the current dir {cwd}.\nOne connection is initiated to create the app.\nYour password is *not* stored.\n'.format(cwd=getcwd())) print('\nThis script generates the Mastodon application credentials for Feed2toot.\nfeed2toot_clientcred.txt and feed2toot_usercred.txt will be written\nin the current directory: {cwd}.\nA connection is initiated to create the application.\nYour password is *not* stored.\n'.format(cwd=getcwd()))
# get the instance # get the instance
instance = input('Mastodon instance url (defaults to https://mastodon.social):') instance = input('Mastodon instance URL (defaults to https://mastodon.social): ')
if not instance: if not instance:
instance = 'https://mastodon.social' instance = 'https://mastodon.social'
elif not instance.startswith('http'): elif not instance.startswith('http'):
@ -33,18 +33,18 @@ elif not instance.startswith('http'):
# get the username # get the username
userok = False userok = False
while not userok: while not userok:
user = input('Mastodon login:') user = input('Mastodon login: ')
if not user: if not user:
print('Your Mastodon username can not be empty') print('Your Mastodon username can not be empty.')
userok = False userok = False
elif '@' not in user or '.' not in user: elif '@' not in user or '.' not in user:
print('Your Mastodon username should be an email') print('Your Mastodon username should be an email.')
userok = False userok = False
else: else:
userok = True userok = True
# get the password # get the password
password = getpass(prompt='Mastodon password:') password = getpass(prompt='Mastodon password: ')
Mastodon.create_app( Mastodon.create_app(
'feed2toot', 'feed2toot',
api_base_url=instance, api_base_url=instance,
@ -60,6 +60,6 @@ try:
) )
except MastodonIllegalArgumentError as err: except MastodonIllegalArgumentError as err:
print(err) print(err)
sys.exit('\nMy guess is bad login/password\n') sys.exit('\nI guess you entered a bad login or password.\n')
print('The feed2toot app was added to your preferences=>authorized apps page') print('feed2toot was added to your preferences=>authorized apps page.')
sys.exit(0) sys.exit(0)