Simplified login signature

This commit is contained in:
jeancf 2022-11-23 15:02:31 +01:00
parent 10616d6c88
commit d79da68b02

View File

@ -330,7 +330,9 @@ def is_time_valid(timestamp):
return ret return ret
def login(instance, account, password): def login(password):
instance = TOML['config']['mastodon_instance']
# Create Mastodon application if it does not exist yet # Create Mastodon application if it does not exist yet
if not os.path.isfile(instance + '.secret'): if not os.path.isfile(instance + '.secret'):
try: try:
@ -353,9 +355,9 @@ def login(instance, account, password):
) )
mastodon.log_in( mastodon.log_in(
username=account, username=TOML['options']['twitter_account'],
password=password, password=password,
to_file=account + ".secret" to_file=TOML['options']['twitter_account'] + ".secret"
) )
logging.info('Logging in to ' + instance) logging.info('Logging in to ' + instance)
@ -737,7 +739,7 @@ def main(argv):
# Login to account on maston instance # Login to account on maston instance
mastodon = None mastodon = None
if len(tweets) != 0: if len(tweets) != 0:
mastodon = login(TOML['config']['mastodon_instance'], TOML['config']['mastodon_user'], mast_password) mastodon = login(mast_password)
# ********************************************************** # **********************************************************
# Iterate tweets in list. # Iterate tweets in list.