From 7c307e100335a15a642b1b821d11094f9f95d0f9 Mon Sep 17 00:00:00 2001 From: jeancf Date: Fri, 18 Nov 2022 16:55:50 +0100 Subject: [PATCH] replaced mast_instance --- twoot.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/twoot.py b/twoot.py index dc6a1b7..0d483c5 100755 --- a/twoot.py +++ b/twoot.py @@ -398,7 +398,6 @@ def main(argv): print('Missing Mastodon user') exit(-1) - # mast_instance = args['i'] # mast_account = args['m'] # mast_password = args['p'] # suppress_retweets = args['s'] @@ -550,7 +549,7 @@ def main(argv): # Check in database if tweet has already been posted db.execute( "SELECT * FROM toots WHERE twitter_account=? AND mastodon_instance=? AND mastodon_account=? AND tweet_id=?", - (toml['config']['twitter_account'], mast_instance, mast_account, tweet_id)) + (toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet_id)) tweet_in_db = db.fetchone() if tweet_in_db is not None: @@ -674,7 +673,7 @@ def main(argv): # Login to account on maston instance mastodon = None if len(tweets) != 0: - mastodon = login(mast_instance, mast_account, mast_password) + mastodon = login(toml['config']['mastodon_instance'], mast_account, mast_password) # ********************************************************** # Iterate tweets in list. @@ -729,7 +728,7 @@ def main(argv): try: mastodon = Mastodon( access_token=mast_account + '.secret', - api_base_url='https://' + mast_instance + api_base_url='https://' + toml['config']['mastodon_instance'] ) if len(media_ids) == 0: @@ -738,7 +737,7 @@ def main(argv): toot = mastodon.status_post(tweet['tweet_text'], media_ids=media_ids, visibility='public') except MastodonError as me: - logging.error('posting ' + tweet['tweet_text'] + ' to ' + mast_instance + ' Failed') + logging.error('posting ' + tweet['tweet_text'] + ' to ' + toml['config']['mastodon_instance'] + ' Failed') logging.error(me) else: @@ -748,7 +747,7 @@ def main(argv): # Insert toot id into database if 'id' in toot: db.execute("INSERT INTO toots VALUES ( ? , ? , ? , ? , ? )", - (toml['config']['twitter_account'], mast_instance, mast_account, tweet['tweet_id'], toot['id'])) + (toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet['tweet_id'], toot['id'])) sql.commit() logging.info(str(posted_cnt) + ' tweets posted to Mastodon')